回答編集履歴
1
JavaScriptソース分け
answer
CHANGED
@@ -12,17 +12,6 @@
|
|
12
12
|
integrity="sha256-FgpCb/KJQlLNfOu91ta32o/NMZxltwRo8QtmkMRdAu8="
|
13
13
|
crossorigin="anonymous"></script>
|
14
14
|
<script>
|
15
|
-
var checkBox = "input[name='chk1']";
|
16
|
-
$(function () {
|
17
|
-
var checkAll = '#checkAll';
|
18
|
-
$( checkAll ).on('click', function(e) {
|
19
|
-
$( checkBox ).prop('checked', this.checked );
|
20
|
-
});
|
21
|
-
|
22
|
-
$(checkBox).on( 'click', function(e) {
|
23
|
-
console.log(e);
|
24
|
-
});
|
25
|
-
});
|
26
15
|
</script>
|
27
16
|
</head>
|
28
17
|
<body>
|
@@ -48,7 +37,25 @@
|
|
48
37
|
<td class="Data">社員B</td>
|
49
38
|
</tr>
|
50
39
|
</table>
|
51
|
-
|
52
40
|
</body>
|
41
|
+
<script src="./jquerytest.js">
|
42
|
+
</script>
|
53
43
|
</html>
|
54
|
-
```
|
44
|
+
```
|
45
|
+
|
46
|
+
jquerytest.js
|
47
|
+
```JavaScript
|
48
|
+
$(function () {
|
49
|
+
var checkBox = "input[name='chk1']";
|
50
|
+
var checkAll = '#checkAll';
|
51
|
+
$( checkAll ).on('click', function(e) {
|
52
|
+
$( checkBox ).prop('checked', this.checked );
|
53
|
+
});
|
54
|
+
|
55
|
+
$(checkBox).on( 'click', function(e) {
|
56
|
+
console.log(e);
|
57
|
+
});
|
58
|
+
});
|
59
|
+
```
|
60
|
+
|
61
|
+
でconsole.log部分来ました
|