mercredi 24 octobre 2018

js - if checkbox checked, setAttribute readonly in an other input [duplicate]

This question already has an answer here:

I have a checkbox like this

<input type="checkbox" name="checkbox" id="checkbox1" value="true" >

and an input text like this

<input id="textbox1" type="text" value="abc" disable="false">

If the checkbox is checked, I would like to disable the text box dynamically (without having to refresh the page. And of course if the user uncheck the checkbox, to able the textbox.

How can I do that ?




Aucun commentaire:

Enregistrer un commentaire