jquery - Checkbox click event not fired -



jquery - Checkbox click event not fired -

i got js (also tried "change" same result)

$("input[class='tag-checkbox']").live("click",function(){ var thischeck = $(this); if (thischeck.is (':checked')){ var tag = $(this).val(); $("#tag-field").val(tag); homecoming false; } });

which should set value of checkbox

<input class="tag-checkbox" type="checkbox" name="tag[]" value="' . $value['name'] . '" />

into textfield

<input id="tag-field" type="text" name="product-tag" />

but event not fired , textfield unchanged. have no error messages wrong script?

try using straight $(this) :

$("input[class='tag-checkbox']").live("click",function(){ if ($(this).is (':checked')){ var tag = $(this).val(); $("#tag-field").val(tag); homecoming false; } });

working illustration @ : http://jsfiddle.net/hzvwe/

anyway problem in script made typo on thischeck (once c capital , not)

jquery

Comments

Popular posts from this blog

iphone - Dismissing a UIAlertView -

intellij idea - Update external libraries with intelij and java -

javascript - send data from a new window to previous window in php -