samedi 27 février 2016

Show/Hide specific div if a checkbox has value of checked

I want to display/hide a div based on whether a certain checkbox is checked or unchecked.

Please note this is not about using jQuery .click or .change function. These don't work in my case.

What I am trying to do is that a certain div to display if a checkbox field has a value checked="checked", otherwise hide it.

I don't want to show/hide anything by default. I want to hide only if checkbox is unchecked and if it's checked, the div should always show (even on page load).

here is the link to Fiddle (.click approach and it does not work for me) http://ift.tt/1QjRBm4

You may notice that First Name checkbox is already checked but its adjacent div is still hidden.

Any help would be highly appreciated.

thanks




Aucun commentaire:

Enregistrer un commentaire