0

I am using a small javascript function which i want to bind to the click event of a span (spancat) element. But when the function is defined with argument , it is not fired. Works fine for chk_1 as well as the commented line. Below is the code

$(document).ready(function()
   $("[name=chk_1]").on('click',showdata(this));
   $("[name=spancat]").on('click',showhidechild('param1'));
   //$("[name=spancat]").on('click',showhidechild));
});

function showhidechild(childele){
            alert('test');
}

I saw the thread mentioned in duplicate and using a working example as well. But could not figure out why it doesnt work in the second place it is used. it is used in the same manner in both cases.

kten
  • 445
  • 4
  • 13
  • 26

0 Answers0