jQuery autoresize with live
How can I use the jquery plugin "autoresize" with JQuery's live()
function best? The problem is, that the plugin creates an textarea behind the current one (with开发者_如何转开发 position absolute). When I use the jquery live()
function I get stuck in an infinite loop, because the textarea
, created by the script, gets another one and so on... Hope that you can follow me.
How can I use live()
with that plugin?
In autoresize.jquery.js
, as you said, it creates a clone of the textarea
to perform text size calculations. Here it is:
return textarea.clone().removeAttr('id').removeAttr('name').css({
As you see it strips name
and id
attributes. You could modify this line to add a class
attribute which you can then filter out with your $.live()
selector. E.g.
return textarea.clone().removeAttr('id').removeAttr('name').addClass('clone').css({
And
$('textarea:not(.clone)').live()
精彩评论