回答編集履歴
1
修正
test
CHANGED
@@ -6,15 +6,29 @@
|
|
6
6
|
|
7
7
|
$(function(){
|
8
8
|
|
9
|
-
// 要素取得
|
10
9
|
|
11
|
-
if ( $(".hoge_child > ul > li").length == 0 ) {
|
12
10
|
|
13
|
-
|
14
11
|
|
15
|
-
$(".hoge_parent").hide();
|
16
12
|
|
13
|
+
$ele = $(".hoge_child");
|
14
|
+
|
15
|
+
$ele.each(function(index, child) {
|
16
|
+
|
17
|
+
$child = $(child);
|
18
|
+
|
19
|
+
|
20
|
+
|
21
|
+
if ( $child.find("ul > li").length == 0 ) {
|
22
|
+
|
23
|
+
$child.parent(".hoge_parent").hide();
|
24
|
+
|
17
|
-
|
25
|
+
}
|
26
|
+
|
27
|
+
|
28
|
+
|
29
|
+
});
|
30
|
+
|
31
|
+
|
18
32
|
|
19
33
|
});
|
20
34
|
|
@@ -28,7 +42,59 @@
|
|
28
42
|
|
29
43
|
<ul>
|
30
44
|
|
45
|
+
|
46
|
+
|
31
|
-
|
47
|
+
</ul>
|
48
|
+
|
49
|
+
</div>
|
50
|
+
|
51
|
+
</div>
|
52
|
+
|
53
|
+
|
54
|
+
|
55
|
+
|
56
|
+
|
57
|
+
<div class="hoge_parent">
|
58
|
+
|
59
|
+
<h4>…</h4> or <h3>…</h3>
|
60
|
+
|
61
|
+
<div class="hoge_child">
|
62
|
+
|
63
|
+
<ul>
|
64
|
+
|
65
|
+
<li>…</li>
|
66
|
+
|
67
|
+
<li>…</li>
|
68
|
+
|
69
|
+
<li>…</li>
|
70
|
+
|
71
|
+
<li>…</li>
|
72
|
+
|
73
|
+
</ul>
|
74
|
+
|
75
|
+
</div>
|
76
|
+
|
77
|
+
</div>
|
78
|
+
|
79
|
+
|
80
|
+
|
81
|
+
|
82
|
+
|
83
|
+
<div class="hoge_parent">
|
84
|
+
|
85
|
+
<h4>…</h4> or <h3>…</h3>
|
86
|
+
|
87
|
+
<div class="hoge_child">
|
88
|
+
|
89
|
+
<ul>
|
90
|
+
|
91
|
+
<li>…</li>
|
92
|
+
|
93
|
+
<li>…</li>
|
94
|
+
|
95
|
+
<li>…</li>
|
96
|
+
|
97
|
+
<li>…</li>
|
32
98
|
|
33
99
|
</ul>
|
34
100
|
|