C# 如何使用java脚本动态创建按钮
c 其显示错误为对象不支持属性或方法“live”live已被定价使用:C# 如何使用java脚本动态创建按钮,c#,javascript,asp.net,C#,Javascript,Asp.net,c 其显示错误为对象不支持属性或方法“live”live已被定价使用: 使用on而不是liveI我仍然在同一个平台上,JavaScript运行时错误:对象不支持属性或方法“on”您使用jQuery吗?如果我使用jQuery,则类型保持不变,即,意味着我只想知道如果使用jQuery,会有什么不同?包括以下内容:code.jQuery.com/jQuery-1.11.0.min.js> foreach (DataRow Row in oDs.Tables[0].Rows)
使用on而不是liveI我仍然在同一个平台上,JavaScript运行时错误:对象不支持属性或方法“on”您使用jQuery吗?如果我使用jQuery,则类型保持不变,即,意味着我只想知道如果使用jQuery,会有什么不同?包括以下内容:code.jQuery.com/jQuery-1.11.0.min.js>
foreach (DataRow Row in oDs.Tables[0].Rows)
{
LitPreferances.Text += "<Li ID=LI_" + Row["pk_Preference_Branch_ID"].ToString() +"_"+ Row["pk_Preference_BranchType_ID"].ToString() +">" + Row["Branch_Name"].ToString() + " <a href='#' title='delete' class='itemDelete' onclick='return RemoveBranch();' tooltip='Remove Branch'>Remove</a></Li>";
}
function RemoveBranch() {
$('.itemDelete').live('click',
function () {
$(this).closest('Li').remove();
}
);
return false;
}
<html>
<head>
<script src="http://code.jquery.com/jquery-1.11.0.min.js"></script>
.
.
.
</head>
</html>
function RemoveBranch() {
$('body').on('click','.itemDelete',function () {
$(this).closest('Li').remove();
});
return false;
}
I got one solution over there, just simply used
function RemoveBranch() { $("#ULPreferences li").click(function () {
$(this).remove(); }); }