jquery-events

[jquery] How to pass arguments to an event handler?

var MyObject = { init: function () { this.items = $('#menu a'); for (var i = 0; i < this.items.length; i++) { $(this.items[i]).bind('click', this.doSomething); } }, doSomething: function (index) { alert(this.items[index].innerHTML); // alerts: One, Two, Three } }; I ...

How to call a function with jquery blur UNLESS clicking on a link?

I have a small jquery script: $('.field').blur(function() { $(this).next().children().hide(); }); The children that is hidden contains some links. This makes it impossible to click the links (because they get hidden). What is an appropriate solution to this? this is as close as I have gotten: $('.field').blur(function() { ...