Is there any ways to catch click on input, only if type of input set to checkbox? Note: I need to catch click without using any classes or id's.
I've tried following:
$('input').on('click', function(){
if($(this).attr('type','checkbox')){
alert("checkbox clicked");
}
});
Well, this is not working and I don't know any other ways. JSFiddle: http://jsfiddle.net/x8utn/
attras setter which returns an object, a truthy value, you are not comparing.if($(this).is(':checkbox')){