Bind jQuery UI autocomplete using .live()

Posted by seth.vargo on Stack Overflow See other posts from Stack Overflow or by seth.vargo
Published on 2010-12-29T03:19:25Z Indexed on 2010/12/29 3:54 UTC
Read the original article Hit count: 212

I've searched everywhere, but I can't seem to find any help...

I have some textboxes that are created dynamically via JS, so I need to bind all of their classes to an autocomplete. As a result, I need to use the new .live() option.

As an example, to bind all items with a class of .foo now and future created:

$('.foo').live('click', function(){
  alert('clicked');
});

It takes (and behaves) the same as .bind(). However, I want to bind an autocomplete...

This doesn't work:

$('.foo').live('autocomplete', function(event, ui){
  source: 'url.php' // (surpressed other arguments)
});

How can I use .live() to bind autocomplete?

UPDATE

Figured it out with Framer:

$(function(){ $('.search').live('keyup.autocomplete', function(){ $(this).autocomplete({ source : 'url.php' }); }); });

© Stack Overflow or respective owner

Related posts about jQuery

Related posts about binding