Saturday, 15 February 2014

javascript - Multipleclicks on checkbox selected issue -



javascript - Multipleclicks on checkbox selected issue -

what did

1. create array of checkboxes unique numeric id 2. on click of <td>(with unique numeric id ) checked-unchecked checkbox 3. used jquery check-uncheck logic.

problem : when click fresh on alter checked. 1 time again click on , unchecked.then go on process , gets stucks on checked.

http://jsfiddle.net/5zqfe/

yup, made sure input declared rather id of td:

$(document).ready(function () { $('.tdbox').click(function () { var tdid = $(this).attr('id'); if ($(this).attr('id') == -1) { homecoming false; } var inp = $(this).find("input[id=" + tdid + "]"); if (inp.is(':checked')) { $(inp).prop("checked", false); $(this).css('background-color', ""); } else { $(inp).prop("checked", true); $(this).css('background-color', "yellow"); } }); });

javascript php jquery html checkbox

No comments:

Post a Comment