0
Disable function does not work.
I want that when user select other then other input field enable otherwise be disabled. my code is https://code.sololearn.com/WngJ7e2GJaAR/?ref=app
4 Respostas
+ 1
Edit your line 45 like this:
<select name="one" onchange="if (this.value=='other'){document.querySelector('#otherField').disabled=false;} else {document.querySelector('#otherField').disabled=true;}">
Also, You should give the "other" field a unique ID (for example, I used "otherField")
PS: You can also use document.getElementById('otherField') instead of document.querySelector('#otherField')
😉
+ 1
It didn't worked because you gave id to the wrong element.
Remove the id attribute from your select and give it to the input text box at line 59. That will solve your problem!
+ 1
thanks
0
I updated code according to your suggestions but problem didn't solve.