jquery - Trigger is not working in my case -


hi trying fire click event of on input changing in it.but not working. please find mistakes have done in code.below html

<table> <tr> <td><input type="radio" id="a"><div class="x"><label for="a">clickhere</label></div></td> <td><input type="checkbox" id="b"><div class="x"><label for="b">clickhere</label></div>      </td> </tr> <tr> <td><input type="radio" id="c"><div class="x"><label for="c">clickhere</label></div></td> <td><input type="checkbox" id="d"><div class="x"><label for="d">clickhere</label></div></td> </tr> </table> 

below jquery code..

          $('table tbody tr').delegate(':radio','change',function()   {          $(this).parents('td').trigger('click')          if(($(this).parents('td').find('input').filter(':checked').length)*1 > 0)           {            $(this).parents('tr').children('td').not($(this).parent('td')).find('input').prop('checked',false)            $(this).parents('td').find('input').prop('checked','checked')           }   });   $('table tbody tr').delegate(':checkbox','change',function()   {       $(this).parents('td').trigger('click')       if($(this).parents('td').find('input').length > 1)       {           if(($(this).parents('td').find('input').filter(':checked').length)*1 > 0)           {            $(this).parents('td').find(":radio").prop('checked',$(this).prop('checked'))            $(this).parents('tr').children('td').not($(this).parent('td')).find('input').prop('checked',false)            $(this).closest('tr').children('td').not($(this).parent('td')).find(':radio').prop('checked',false);             }       }       if(($(this).parents('td').find('input').filter(':checked').length)*1 > 0)           {        $(this).parents('tr').children('td').not($(this).parent('td')).find('input').prop('checked',false)             }   });     $('table tbody tr').delegate('td','click',function() {      alert("clicked index is"+$(this).index()) }); 

i can't understand, want, try this:

$('table tbody tr td').click(function() {      alert("clicked index is"+$(this).index()) }); 

Comments

Popular posts from this blog

c# - SharpSVN - How to get the previous revision? -

c++ - Is it possible to compile a VST on linux? -

url - Querystring manipulation of email Address in PHP -