jQuery fire checkbox click with value -


i need fire checkbox click value open dialog...can explain why not working?

form:

<span class="wpcf7-form-control-wrap obj">     <span class="wpcf7-form-control wpcf7-checkbox wpcf7-validates-as-required wpcf7-exclusive-checkbox">         <span class="wpcf7-list-item first">             <label>                 <input type="checkbox" name="obj" value="value 1" />                 <span class="wpcf7-list-item-label">value 1</span>             </label>         </span>         <span class="wpcf7-list-item">             <label>                 <input type="checkbox" name="obj" value="value 2" />                 <span class="wpcf7-list-item-label">value 2</span>             </label>         </span>         <span class="wpcf7-list-item last">             <label>                 <input type="checkbox" name="obj" value="other" />                 <span class="wpcf7-list-item-label">other</span>             </label>         </span>     </span> </span> 

script:

jquery(document).ready(function($){     $("input[type=checkbox][value='value 1']").on('click',function() {         alert('abcd');     }); }); 

looks need delegate event, e.g:

$(document).on('click', "input[type=checkbox][value='value 1']", function() {         alert('abcd');     }); 

please read: https://learn.jquery.com/events/event-delegation/


Comments

Popular posts from this blog

android - Get AccessToken using signpost OAuth without opening a browser (Two legged Oauth) -

org.mockito.exceptions.misusing.InvalidUseOfMatchersException: mockito -

google shop client API returns 400 bad request error while adding an item -