Use jQuery to attach behavior after a new element has been added to the DOM? -


i'm using jeditable, turns div nice little form complete textarea, cancel , submit buttons on-the-fly.

after jeditable creates textarea created , adds dom, i'd attach elastic plugin element (so textbox expands , shrinks nicely).

i'm using $.live() - waits user click on form, attaches elastic plugin.

it cool if attach elastic right after element created - without messing around plugin code - possible?

don't use .live(). instead, after have initialized jeditable plugin chain click event handler

 $(function() {      $('.edit').editable(          'http://www.example.com/save.php',           {              type      : 'textarea',              cancel    : 'cancel',              submit    : 'ok',              tooltip   : 'click edit'          }      )      .click(function() {          $(".edit textarea").elastic();      });  }); 

try fiddle
http://jsfiddle.net/kkg2b/1/


Comments

Popular posts from this blog

apache - Add omitted ? to URLs -

redirect - bbPress Forum - rewrite to wwww.mysite prohibits login -

php - How can I stop spam on my custom forum/blog? -