mercredi 29 juillet 2015

How to automatically uncheck a checkbox with javascript if other is already checked?

How to automatically uncheck a checkbox with javascript if a user checks another one? I have this script:

<input type="checkbox" name="use_ssh" value="yes">SSH
<input type="checkbox" name="use_vpn" value="yes">VPN

if a user checks SSH but he also tries to check VPN then a javascript code will automatically uncheck SSH and leave VPN checked and the otherwise. How can I do that with javascript? Basically I just want one checkbox checked instead of two. Please don't ask me why I use checkbox instead of other methods, I will have to rewrite the whole script if I use other methods and I don't have enough time to do that.




Aucun commentaire:

Enregistrer un commentaire