动态创建按钮-JQueryMobile [英] Create Button Dynamically - JQueryMobile
本文介绍了动态创建按钮-JQueryMobile的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
如何使用jQuertMobile动态创建按钮.
How to create the button dynamically using jQuertMobile.
推荐答案
非常简单:
首先通过以下方法创建按钮HTML JQuery元素:
First create a button HTML JQuery element by:
var button = $("<button>My Button</button>");
下一步,将按钮插入页面中所需的位置:
Next, inject the button wherever you want it to be in the page:
$("#my_button_div").append(button);
最后在按钮上运行button()JQuery Mobile命令:
And finally run the button() JQuery Mobile command on the button:
button.button();
您现在应该在页面中具有一个功能齐全且具有JQM样式的按钮.
You should have a functional and JQM styled button in your page by now.
这篇关于动态创建按钮-JQueryMobile的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文