php - Checkbox to be checked when condition satisfies -
how check checkbox when status satisfies?
<input name="pt_id[]" id="pt_id" type="checkbox" value="<?php echo the_id(); ?>" <?php if(isset($_post["pt_id"])) { echo 'checked="checked"'; } ?>/> <?php echo the_title(); ?>
please help me. give me solution or suggestion this?
well code need using php. if want grab event lets user clicks on div , want check checkbox need utilize javascript/jquery.
sample code (using jquery):
$(document).on('click', '#yourdiv', function() { $('#pt_id').attr('checked', true); });
this check checkbox when yourdiv clicked
if wish uncheck when div2 clicked this:
$(document).on('click', '#div2', function() { $('#pt_id').attr('checked', false); });
php forms checkbox
No comments:
Post a Comment