質問編集履歴

1

追記

2016/04/08 02:02

投稿

hidepon
hidepon

スコア206

test CHANGED
File without changes
test CHANGED
@@ -51,3 +51,87 @@
51
51
 
52
52
 
53
53
  ```
54
+
55
+ 追記
56
+
57
+
58
+
59
+ ```
60
+
61
+ <table id="pt2" border="1" class="table ap_table">
62
+
63
+ <tbody>
64
+
65
+ <tr>
66
+
67
+ <th>実施日2</th>
68
+
69
+ <td>
70
+
71
+ <input type="text" id="target_year2" name="target_year2" size="4" maxlength="4" class="inp" value="<?php echo $target_year;?>" />年
72
+
73
+ <input type="text" id="target_month2" name="target_month2" size="2" maxlength="2" class="inp" value="<?php echo $target_month;?>" />月
74
+
75
+ <input type="text" id="target_day2" name="target_day2" size="2" maxlength="2" class="inp" value="<?php echo $target_day;?>" />日
76
+
77
+ <input type="button" id="dp_pos2" name="dp_pos2" value="日付選択" />
78
+
79
+ <input type='hidden' id='container' />
80
+
81
+ </td>
82
+
83
+ </tr>
84
+
85
+ </tbody>
86
+
87
+ </table>
88
+
89
+ <div id='dpbody' style='position:absolute;left:200px'></div>
90
+
91
+ //JS
92
+
93
+ $('#container').datepicker({
94
+
95
+ language : ja,
96
+
97
+ clearBtn : true,
98
+
99
+ container : '#dpbody'
100
+
101
+ }).on('changeDate', function(){
102
+
103
+ if(e.date){
104
+
105
+ var d = e.date;
106
+
107
+ $('#target_year2').val( d.getFullYear() );
108
+
109
+ $('#target_month2')val( d.getMonth() + 1 );
110
+
111
+ $('#target_day2').val( d.getDate());
112
+
113
+ }
114
+
115
+ $(this).datepicker('hide')
116
+
117
+ });
118
+
119
+ $('#dp_pos2').on('click', function(){
120
+
121
+ $('#container').datepicker('show').on( 'changeDate', function( e ) {
122
+
123
+ $('#target_year2').val( e.date.getFullYear() );
124
+
125
+ $('#target_month2').val( e.date.getMonth() + 1 );
126
+
127
+ $('#target_day2').val( e.date.getDate());
128
+
129
+ $(this).datepicker('hide')
130
+
131
+ });
132
+
133
+ });
134
+
135
+
136
+
137
+ ```