我有一个从AJAX加载的表单。在这个表单上有一个输入类型按钮,我想像它一样管理它。
$("#button_id").on("click",function(){..}); 但不管用..。
我的问题是如何做这项工作?
Javascript/Jquery代码
function openForm('commandForm')
{
$.ajax({
type: "POST",
url: "./forms/commandForm.php",
data: $('#'+frm).
dataType: "html",
beforeSend: function(msg){
$('#ResponseDiv').html('Loding....');
},
success: function(back_data){
$('#ResponseDiv').html(back_data);
}
});
}commandForm.php
<form id="commandForm" action="postCommand.php" method="post" >
.....
....
<button type="Button" id="postButton" />
</form>Jquery on postButton点击
$(document).ready(function () {
$('#postButton').on("click", function (e) {
/*....*/
}); //This don't work
}PS:我不想直接提交表格!只需在这里的javascript function...out中运行我自己的校验表即可。因此,我只希望按钮在Onclick ...so上做出反应,例如执行警报,或者其他任何javacript函数。
发布于 2019-02-17 11:41:28
发布于 2019-02-17 13:55:47
现在我明白了。这能帮到你-
$(document).ready(function () {
$("#id").click(function (e) {
//.........
}); //This will work
}https://stackoverflow.com/questions/54731695
复制相似问题