我使用jquery弹性插件来扩展文本框。它工作得很好,但我想在使用 ajax 添加到 DOM 的文本框中使用它,但不幸的是这个插件没有实时内置功能。</p>
有办法解决这个问题吗?
最佳答案
如果您可以控制文本区域的创建,则只需在创建文本区域后调用 .elastic()
即可:
// In whatever AJAX callback creates the textarea...
var newTextarea = $('<textarea></textarea>');
// Append the element to the DOM wherever it belongs...
parentElement.append(newTextarea);
// Add elastic behavior.
newTextarea.elastic();
关于javascript - 支持 jquery 弹性插件吗?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/1943552/