Ok, as too often, I should have been reading more topics on the
discussion group before posting.
If anyone runs into this problem, check out this magnificent plugin
called Livequery: http://brandonaaron.net/docs/livequery/#getting-started
Awesome.
On 30 aug, 12:52, bytte <[EMAIL PROTECTED]> wrote:
> I have read and (for the most part) understood the article about event
> delegation that's listed here:
>
> I have successfully used the event delegation to trigger events on
> click, as listed in the article. Now I want to do the same with form
> inputs, but the blur event seems not to work like this:
>
> $(document).ready(function() {
> $('body').blur( function(event) {
> if($(event.target).is('[EMAIL PROTECTED]')) {
> var id = $(event.target).attr("id").substr($
> (event.target).attr("id").lastIndexOf('_')+1);
> updatePrice(id);
> }
> });
>
> });
>
> It works if I use "click" instead of "blur" but then the function
> updatePrice() isn't fired when the user uses the keyboard tab to skip
> through form inputs.
>
> The form inputs are placed there by an ajax function, so they're not
> in the dom when the page is loaded.
>
> Any idea on how to get the blur event working?