I am using JQuery 1.4.1. I have HTML input elements which created dynamically. I have assigned "focusin" event all input elements. While loading page, it is triggers only once while focusing each input element.
Problem is, When I minimize and maximize the page, focus event is fired multiple times. Finally it show "Stack overflow at line 0".
$('input').live("focusin",function(objectRef) {
alert("focusin event");
})
What could be causing this problem?
Don't worry. It only happens when you call alert()
. But I don't really understand why clicking the OK button on the alert box will trigger the event multiple times.
Try this instead and it will only fires once, as expected.
$('input').live("focusin",function(objectRef) {
//alert("focusin event");
$("#some_div").append('focus!');
})
Same as focus
, click
, and other events.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With