Search code examples
jquerycssajaxhtmlicheck

Ajax checkbox checked wont work


I have a checkbox with id #cond99; it's loaded form ajax, and that's working okay but I want to add an action and it's not working. Can anyone help me?

jQuery = window.parent.jQuery;   
jQuery(document).ready(function ()   
{    
   jQuery('input.styled').iCheck(   
   {    
       checkboxClass: 'icheckbox_minimal-orange',   
       radioClass: 'iradio_minimal-orange',  
       increaseArea: '40%' // optional  
   });      
   jQuery('input.styled').iCheck('update');   
   jQuery("#cond999").bind("change", function ()  
   {   
       jQuery('#conditions_more').toggle();   
   });   
});   

Solution

  • If it's loaded dynamically you can use event delegation -

    jQuery(document).on("change","#cond999", function () {
          jQuery('#conditions_more').toggle();
    });