javascript - Access checkbox element in my form with JQuery -


i have (struts generated) html code:

<form accept-charset="utf-8" class="search" method="get" action="facturable/list.action" name="list" id="list">  <div class="fieldset_medium_right">                             <div class="label">                                 <input type="checkbox" id="list_allso" value="true" name="allso"> <input type="hidden" value="true" name="__checkbox_allso" id="__checkbox_list_allso">                               </div>                             <div label""="" class="">                                 <input type="checkbox" id="list_allent" value="true" name="allent"> <input type="hidden" value="true" name="__checkbox_allent" id="__checkbox_list_allent">                               </div>                             <div label""="" class="">                                 <input type="checkbox" id="list_allua" value="true" name="allua"> <input type="hidden" value="true" name="__checkbox_allua" id="__checkbox_list_allua">                               </div>                         </div>  </form> 

before checkboxes out of form, access them using: $('#__checkbox_allua') .click( function() {

now in form can't figure out how access them. have tried things form.__checkbox_allua or form.element('__checkbox_allua') without success.

thank in advance help.

from html posted, let's take sample below example:

<input type="checkbox" id="list_allua" value="true" name="allua">  <input type="hidden" value="true" name="__checkbox_allua" id="__checkbox_list_allua"> 

here how select each of elements:

$('#list_allua').....// checkbox $('#__checkbox_list_allua').... // associated hidden value 

quite likely, not need attach event handler hidden element might want checkbox:

$('#list_allua').click( function() { .... }); 

or, if checkbox being dynamically added:

$(document).on('click', '#list_allua', function() { ....... }); 

Comments

Popular posts from this blog

database - VFP Grid + SQL server 2008 - grid not showing correctly -

jquery - Set jPicker field to empty value -

.htaccess - htaccess convert request to clean url and add slash at the end of the url -