我试图在链接点击时调用 jquery 函数但没有成功:
这是我的html:
<a href="..." id="removeItem" checkID="12" >Delete</a>
<a href="..." id="removeItem" checkID="13" >Delete</a>
<a href="..." id="removeItem" checkID="14" >Delete</a>
$("#removeItem").click(function(checkID) {
return false;
var checkID = $(this).attr("checkID");
$("#removeDialog").dialog( {
buttons: {
"No" : function () {
$(this).dialog("destroy");
$('input#CheckName').focus();
},
"Yes": function () {
$.ajax({
url: "itemRemoveWS.html?id=checkID",
data: {
"action" : "remove",
"id" : checkID
},
success: function (data) {
$("#removeDialog").dialog("destroy");
var ang = '';
var obj = $.parseJSON(data);
$.each(obj, function() {
ang += '<table class="form"><tr><td width="45">' + this["CheckID"] + '</td><td width="140">' + this["Name"] + '</td><td width="95">' + this["CheckNumber"] + '</td><td align="right" width="70">$' + this["Amount"] + '</td><td width="220" style="padding-left: 15px;">' + this["Description"] +'</td><td><a href="#">Delete</a></td></tr></table>';
});
$('#container').html(ang);
$("input#Amount").val('');
$("input#CheckName").val('');
$("input#Check_Number").val('');
$("select#Company").val('MMS');
$("th#dept").hide();
$('input#CheckName').focus();
}
});
}
}
});
});