jQuery的:其它元素之后添加元素 [英] jQuery: Add element after another element
本文介绍了jQuery的:其它元素之后添加元素的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我有一定的文本框,我想后添加一个div。
我已经试过.append()函数,但只增加了DIV中的元素。
例如,我有:
<输入类型=文本ID =喇嘛/>
和我想改变这种状况为:
<输入类型=文本ID =喇嘛/>< DIV ID =空间>< / DIV>
解决方案
请尝试使用后()
方法:
$('#BLA')之后。('< DIV ID =空间>< / DIV>');
I have a certain textbox and I want to add a div after it. I've tried the .append() function, but that only adds the div in the element.
For example, I have:
<input type="text" id="bla" />
and I want to change that into:
<input type="text" id="bla" /><div id="space"></div>
解决方案
try using the after()
method:
$('#bla').after('<div id="space"></div>');
这篇关于jQuery的:其它元素之后添加元素的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文