jquery如何添加一个元素到dom [英] Jquery how add an element to dom
本文介绍了jquery如何添加一个元素到dom的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我认为我需要添加元素到dom,但我不知道该怎么做。
组合的id是'selectCombo'
解决方案
你有几个选择:
- .prepend() http://api.jquery。 com / prepend /
- .append() http:/ /api.jquery.com/append/
- .insertAfter() http://api.jquery.com/insertAfter/
- .insertBefore() http://api.jquery.com/insertBefore/
Hello I have a function that add combobox into the page, and I need to use the values of these combobox. When I try to acces into the jquery code it don't work. I think that I need to add the element to dom but I don't know how to do that. The id of combo is 'selectCombo'
解决方案
You have several choices:
- .prepend() http://api.jquery.com/prepend/
- .append() http://api.jquery.com/append/
- .insertAfter() http://api.jquery.com/insertAfter/
- .insertBefore() http://api.jquery.com/insertBefore/
这篇关于jquery如何添加一个元素到dom的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文