javascript - Enable/disable checkboxs using links instead of checkboxs -


i have checkbox add , remove service. looks this:

<div class="cknow" align="center" valign="top">add/remove checkout     <input type="checkbox" id="cknow_<?php echo $i;?>" name="cknow[<?php echo $i;?>]"></input> </div> 

i've got script says this:

$('input[id^=cknow_]').each(function(){     $(this).bind('click',function(){         if($(this).attr('checked'))         {.... stuff } 

it's working great single checkbox i'd make text 'add/remove' text links (without input box of checkbox) when add clicked registers checked , when remove clicked, registers unchecked.

how can this?

you can use label element assign text checkbox, use css hide checkbox so:

html

<label>add/remove   <input type="checkbox" id="cknow_" name="cknow" class="hideme">   </input> </label> 

css

.hideme {   display:none; } 

Comments

Popular posts from this blog

user interface - How to replace the Python logo in a Tkinter-based Python GUI app? -

objective c - Greedy NSProgressIndicator Allocation -

how to set an OCR language in Google Drive -