回答編集履歴

1

JavaScript only

2019/09/25 22:20

投稿

kyoya0819
kyoya0819

スコア10429

test CHANGED
@@ -1,28 +1,28 @@
1
1
  ```HTML
2
2
 
3
- <input id="check"type="checkbox"name="check"onclick="hoge()"/><label>同意する</label>
3
+ <input id="check" type="checkbox" name="check" onclick="hoge()"/>
4
4
 
5
+ <label>同意する</label>
6
+
5
- <button id="but"type="submit"disabled={isSubmitting}>登録</button>
7
+ <button id="but" type="submit" disabled={isSubmitting}>登録</button>
6
8
 
7
9
  ```
8
10
 
9
- ```jQuery
11
+ ```JavaScript
10
12
 
11
- $('#check').click(function(){
13
+ function hoge() {
12
14
 
13
- if($("#check:checked").val()) {
15
+ if(document.getElementById('check').checked == true) {
14
16
 
15
- $("#but").prop("disabled", false)
17
+ document.getElementById('but').disabled = false;
16
18
 
17
- }
19
+ } else {
18
20
 
19
- else {
21
+ document.getElementById('but').disabled = true;
20
22
 
21
- $("#but").prop("disabled", true);
23
+ }
22
24
 
23
- }
25
+ }
24
-
25
- });
26
26
 
27
27
  ```
28
28