回答編集履歴
1
chousei
test
CHANGED
@@ -23,3 +23,59 @@
|
|
23
23
|
});
|
24
24
|
|
25
25
|
```
|
26
|
+
|
27
|
+
|
28
|
+
|
29
|
+
# 更新ボタン
|
30
|
+
|
31
|
+
```javascript
|
32
|
+
|
33
|
+
<script>
|
34
|
+
|
35
|
+
$(function () {
|
36
|
+
|
37
|
+
var template = [
|
38
|
+
|
39
|
+
'', 'テンプレ1', 'テンプレ2', 'テンプレ3'
|
40
|
+
|
41
|
+
];
|
42
|
+
|
43
|
+
$('select').on('change', function () {
|
44
|
+
|
45
|
+
var i = $(this).val();
|
46
|
+
|
47
|
+
$('textarea').val(template[i]);
|
48
|
+
|
49
|
+
});
|
50
|
+
|
51
|
+
$('#mod').on('click',function(){
|
52
|
+
|
53
|
+
$('select').trigger('change');
|
54
|
+
|
55
|
+
});
|
56
|
+
|
57
|
+
});
|
58
|
+
|
59
|
+
</script>
|
60
|
+
|
61
|
+
<form action="">
|
62
|
+
|
63
|
+
<select name="" id="">
|
64
|
+
|
65
|
+
<option value="">----</option>
|
66
|
+
|
67
|
+
<option value="1">サンプル1</option>
|
68
|
+
|
69
|
+
<option value="2">サンプル2</option>
|
70
|
+
|
71
|
+
<option value="3">サンプル3</option>
|
72
|
+
|
73
|
+
</select>
|
74
|
+
|
75
|
+
<input type="button" value="更新" id="mod">
|
76
|
+
|
77
|
+
<textarea name="" id="" cols="30" rows="10"></textarea>
|
78
|
+
|
79
|
+
</form>
|
80
|
+
|
81
|
+
```
|