动态添加Jquery ui按钮 [英] Add Jquery ui button dynamically
本文介绍了动态添加Jquery ui按钮的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我有一个javascript函数,可以删除现有按钮并添加新按钮。
I have a javascript function that removes the existing buttons and adds new ones instead.
以下是代码:
function FunctionName(){
("button").remove();
// This works fine.
//but however, with the following add code, I don;t get a jquery ui button.
var element = document.createElement("input");
element.setAttribute("type","button");
// other code
divName = get <div> by ID;
divName.appendChiled(element);
}
有没有办法动态添加jquery ui按钮:
Is there any way to add a jquery ui button dynamically:
喜欢:
divName.add(button);
它没有用......
It did not work...
推荐答案
添加一个使用jQuery的jQuery UI按钮:
To add a jQuery UI button using jQuery:
$('#selector') // Replace this selector with one suitable for you
.append('<input type="button" value="My button">') // Create the element
.button() // Ask jQuery UI to buttonize it
.click(function(){ alert('I was clicked!');}); // Add a click handler
这篇关于动态添加Jquery ui按钮的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文