回答編集履歴

3

サンプルコードを追加

2016/12/15 08:25

投稿

motuo
motuo

スコア3027

test CHANGED
@@ -1,3 +1,103 @@
1
1
  ソースのコメントにある通り```$('label').hide();```が初期表示時に、Labelを隠しています。
2
2
 
3
3
  その為、この行を消してしまえばよいのではないでしょうか。
4
+
5
+ ```html
6
+
7
+ <html>
8
+
9
+ <head>
10
+
11
+ <script src="http://code.jquery.com/jquery-1.11.1.min.js"></script>
12
+
13
+ <script>
14
+
15
+ $(function() {
16
+
17
+ //This hides all initial textboxes
18
+
19
+ //$('label').hide();
20
+
21
+ $('#ons').change(function() {
22
+
23
+ //This saves some time by caching the jquery value
24
+
25
+ var val = $(this).val();
26
+
27
+ //this hides any boxes that the previous selection might have left open
28
+
29
+ $('label').hide();
30
+
31
+ //This just opens the ones we want based off the selection
32
+
33
+ $('.' + val).show();
34
+
35
+ });
36
+
37
+ //I'm not really sure why these are here
38
+
39
+ $("input")
40
+
41
+ .focus(function () {
42
+
43
+ $(this).next("span").fadeIn(1000);
44
+
45
+ })
46
+
47
+ .blur(function () {
48
+
49
+ $(this).next("span").fadeOut(1000);
50
+
51
+ });
52
+
53
+ });
54
+
55
+ </script>
56
+
57
+ </head>
58
+
59
+ <body>
60
+
61
+ <form>
62
+
63
+ <select id="ons">
64
+
65
+ <option value="13">第13号 2016 autumn</option>
66
+
67
+ <option value="12">第12号 2016 spring</option>
68
+
69
+ <option value="11">第11号 2016 winter</option>
70
+
71
+ </select>
72
+
73
+ </form>
74
+
75
+ <label id="label1" for="13" class="13">
76
+
77
+ <div class="image paper"><a href="url" target="_blank"><img src="写真" width="780" alt=""/></a></div>
78
+
79
+ <div class="btn trans"><a href="url"><span>PDFダウンロード</span></a></div>
80
+
81
+ </label>
82
+
83
+ <label id="label2" for="12" class="12">
84
+
85
+ <div class="image paper"><a href="url" target="_blank"><img src="写真" width="780" alt=""/></a></div>
86
+
87
+ <div class="btn trans"><a href="url"><span>PDFダウンロード</span></a></div>
88
+
89
+ </label>
90
+
91
+ <label id="label3" for="11" class="11">
92
+
93
+ <div class="image paper"><a href="url" target="_blank"><img src="写真" width="780" alt=""/></a></div>
94
+
95
+ <div class="btn trans"><a href="url"><span>PDFダウンロード</span></a></div>
96
+
97
+ </label>
98
+
99
+ </body>
100
+
101
+ </html>
102
+
103
+ ```

2

サンプルコードを追加

2016/12/15 08:25

投稿

motuo
motuo

スコア3027

test CHANGED
File without changes

1

サンプルコードを追加

2016/12/15 08:24

投稿

motuo
motuo

スコア3027

test CHANGED
File without changes