I made a form with two radio buttons, two textboxes and when one radio button is clicked one textbox is enable and the other one will be disable. But how to make radio button checked at the beginning before the radio button is clicked ?
Here is my code that will enable a textbox when radio button is clicked:
<input onclick="document.getElementById('agree_ad').disabled = false; document.getElementById('agree_bs').disabled = true;" type="radio" name="type1">
<input name="Agreement_ad" type="text" class="textField" placeholder="yyyy/mm/dd" id="agree_ad" />
<input onclick="document.getElementById('agree_ad').disabled = true; document.getElementById('agree_bs').disabled = false;" type="radio" name="type1" value="customurl1">
<input name="Agreement_bs" type="text" class="textField" placeholder="yyyy/mm/dd" id="agree_bs" />
What should I do to make first radio button clicked and textbox id="agree_bs"
disable by default before click event is triggered.
Aucun commentaire:
Enregistrer un commentaire