I want to add a change
, click
or any other event to detect when checkbox change to show a hidden field. I achieved to reproduce this demo and it's working using a dropbox, now I want to customize with a checkbox.
If I use an accept
checkbox it works like a charm in this way:
[acceptance name id:name]
Creates
<input type="checkbox" id="name" value="Value">
Then
$('#name').change(function() {
if ($("#name")[0].checked == true) {
But as long as checkbox creates an array even with one option:
[checkbox name id:name "Value"]
Creates
<input type="checkbox" name="name[]" value="Value">
When I do same does not work. I can find checked
value using this ugly path:
$("#name")[0].childNodes[0].childNodes[0].checked
But change
, click
or other events are not present to set up...
How can I access to event in the checkbox to show hidden field when checked?
Aucun commentaire:
Enregistrer un commentaire