我正在使用 jquery.html() 函数将表单加载到 jquery-ui 对话框中,然后提交不起作用(警报不显示) - 有人可以告诉我为什么吗?
这里是:http: //jsfiddle.net/GMcev/11/
我正在使用 jquery.html() 函数将表单加载到 jquery-ui 对话框中,然后提交不起作用(警报不显示) - 有人可以告诉我为什么吗?
这里是:http: //jsfiddle.net/GMcev/11/
You need delegate event. Because your button is added to DOM after page load ie. dynamically, so you need something like following:
$('body').on('click', '.button', function() {
alert('TEST!'); //it doesnt work
});
称呼
$(".button").click(function() {
alert('aaa');
在对话框的打开动作中
$("#dialog").dialog({
autoOpen: false,
title: "contact",
open: function() {
$(".button").click(function() {
alert('aaa');
});
}
});
我建议将 onclick 放在提交按钮中
<input type='submit' name='submit' class='button'
id='submit' value='Zapisz' onclick='dingDong()' />