0
我有一個ID爲「addCat」的表單..我使用jquery將ID更改爲「editCat」,並填寫表單輸入與預先存在的數據,然後提交新的表單。jQuery更改表單ID並提交「新」表格
aparantly新的身份證更新但窗體不提交?
$("#addTags").on("submit",function(){
var dataString = $(this).serialize();;
$.post("./Scripts/adminDoAddCat.php", dataString, function (data) {
if (data == "1") {
$('div.add_result').html("<h3>New Category Added Successfully</h3>").fadeIn(800);
}
if (data == "0") {
alert("Something went wrong");
}
});
return false;
});
$("tbody tr td a.fa-pencil-square").on("click",function(){
$("form#addTags").attr('id','editTags');
alert($('form').attr('id')); //this is the way i make sure ID is updated
});
$("#editTags").on("submit",function(){
var dataString = $(this).serialize();;
alert(dataString); //making form is recognized but it's not working
return false;
});
仍未感應到表單提交事件 –
@TarekSawah,您是否使用過事件代表團? – Satpal
+1,但attr()也可以工作,應該用來更新DOM屬性 –