如何使用jquery在动态生成的textarea上自动运行方法? [英] How do I automatically run a method on a dynamically generated textarea with jquery?
本文介绍了如何使用jquery在动态生成的textarea上自动运行方法?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我正在使用插件( https://github.com/jaz303/jquery-grab-bag/blob/master/javascripts/jquery.autogrow-textarea.js ),可以动态调整文本区域的大小.
I'm using a plugin (https://github.com/jaz303/jquery-grab-bag/blob/master/javascripts/jquery.autogrow-textarea.js) that dynamically resizes textareas.
我要使用它
$('textarea').autogrow()
文档准备就绪时.
但是,它不适用于通过ajax调用检索的动态生成的文本区域.我该如何自动autogrow()新的textareas?
However, it doesn't work on dynamically generated textareas retrieved by ajax calls. How can I automatically autogrow() new textareas?
推荐答案
在ajax成功事件函数中,再次将$('textarea').autogrow()
将请求中的文本放入页面后.
In your ajax success event function put once again the $('textarea').autogrow()
after you place the text from request into page.
这篇关于如何使用jquery在动态生成的textarea上自动运行方法?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文