I not know why not work following code for my function(alert()) and is run my function(alert()) after tow times click on button, did you can guide me?
Demo:(Here see my full code) http://jsfiddle.net/pRXQ7/1/
$('.iu').click(function() {
if(alert() == true){
alert('ok')
}else{
alert('no')
}
});
By naming your function
alert, you’ve effectively overridden the native javascriptalertfunction. Name it something else.Also, in your
alertfunction, you are referencingthis. In the scope of the function,thispoints to the document object, not the element which was clicked. Try passing the element instance to your function from the click event handler.See http://jsfiddle.net/pRXQ7/15/