Jquery persistent css selector equivalent to '.live()'

Posted by Dan on Stack Overflow See other posts from Stack Overflow or by Dan
Published on 2010-04-06T15:18:56Z Indexed on 2010/04/06 15:33 UTC
Read the original article Hit count: 182

Filed under:
|
|

So today I just came across the 'live()' function that binds any future and past elements to the whatever event you choose, such as 'onclick'.

Right now I'm having to set up buttons like the following each time I load a new button via ajax ...

$('a.btn.plus').button({icons:{primary:'ui-icon-plusthick'}});
$('a.btn.pencil').button({icons:{primary:'ui-icon ui-icon-pencil'}});
$('a.btn.bigx').button({icons:{primary:'ui-icon ui-icon-closethick'}});

So, instead of calling these lines each time I use ajax to add a new button, is there a similar way to tell JQuery to setup my buttons ANYTIME I add new ones?

Thanks for any help!

© Stack Overflow or respective owner

Related posts about jQuery

Related posts about .live