回答編集履歴

1

コメントに対する追記

2015/06/13 10:21

投稿

ryunix
ryunix

スコア1656

test CHANGED
@@ -17,3 +17,123 @@
17
17
 
18
18
 
19
19
  参考: [Datepicker | jQuery UI](https://jqueryui.com/datepicker/)
20
+
21
+
22
+
23
+
24
+
25
+ -- 追記
26
+
27
+ 一旦、最小限動く物が出来たので載せます。
28
+
29
+ 画像をトリガーで開きたいなら、`datepicker()`の引数に指定すれば良さそうです。
30
+
31
+ 参考: [jQuery UI Datepicker - Icon trigger](https://jqueryui.com/resources/demos/datepicker/icon-trigger.html)
32
+
33
+
34
+
35
+ test.html
36
+
37
+ ```lang-html
38
+
39
+ <!DOCTYPE html>
40
+
41
+ <html lang="ja">
42
+
43
+ <head>
44
+
45
+ <meta charset="utf-8">
46
+
47
+ <link rel="stylesheet" href="https://ajax.googleapis.com/ajax/libs/jqueryui/1.11.4/themes/smoothness/jquery-ui.css">
48
+
49
+ </head>
50
+
51
+ <body>
52
+
53
+ <button id="get">get</button>
54
+
55
+ <div id="result"></div>
56
+
57
+ <script src="https://ajax.googleapis.com/ajax/libs/jquery/1.11.3/jquery.min.js"></script>
58
+
59
+ <script src="https://ajax.googleapis.com/ajax/libs/jqueryui/1.11.4/jquery-ui.min.js"></script>
60
+
61
+ <script>
62
+
63
+ <!--
64
+
65
+ $(function() {
66
+
67
+
68
+
69
+ $('#get').click(function() {
70
+
71
+
72
+
73
+ $.ajax({
74
+
75
+ type: 'GET',
76
+
77
+ url: 'data.json',
78
+
79
+ dataType: 'json',
80
+
81
+ success: function(json){
82
+
83
+
84
+
85
+ var html = '';
86
+
87
+ html += '<div class="col-sm-3">';
88
+
89
+ html += '<input type="text" id="datepicker" value="' + json[0].date + '">';
90
+
91
+ html += '</div>';
92
+
93
+
94
+
95
+ $('#result').append(html);
96
+
97
+
98
+
99
+ $('#datepicker').datepicker();
100
+
101
+ }
102
+
103
+ });
104
+
105
+
106
+
107
+ });
108
+
109
+
110
+
111
+ });
112
+
113
+ //-->
114
+
115
+ </script>
116
+
117
+ </body>
118
+
119
+ </html>
120
+
121
+ ```
122
+
123
+
124
+
125
+ data.json
126
+
127
+ ```lang-json
128
+
129
+ [
130
+
131
+ {
132
+
133
+ "date": "2015/06/13"
134
+
135
+ }
136
+
137
+ ]
138
+
139
+ ```