回答編集履歴

1

sample

2018/07/10 09:15

投稿

yambejp
yambejp

スコア114843

test CHANGED
@@ -1,3 +1,41 @@
1
1
  いろいろ課題が多いですが、UIだけ言えば
2
2
 
3
3
  radiocheckが2に変わったらtextcheckをdisabledにすればいいだけでは?
4
+
5
+
6
+
7
+ # sample
8
+
9
+
10
+
11
+ ```javascript
12
+
13
+ <script>
14
+
15
+ window.addEventListener('DOMContentLoaded', function(e){
16
+
17
+ [].forEach.call(document.querySelectorAll('#form1 [name=radiocheck]'),function(x){
18
+
19
+ x.addEventListener('change',function(e){
20
+
21
+ document.querySelector('#form1 [name=textcheck]').disabled=(e.target.value=="2");
22
+
23
+ });
24
+
25
+ });
26
+
27
+ });
28
+
29
+ </script>
30
+
31
+ <form id="form1">
32
+
33
+ <input type = "text" name = "textcheck">
34
+
35
+ <input type = "radio" name = "radiocheck" value = "1" checked> A
36
+
37
+ <input type = "radio" name = "radiocheck" value = "2" > B
38
+
39
+ </form>
40
+
41
+ ```