2014-03-06 24 views
-1
C# 


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() + "&nbsp;&nbsp;<a href='#' title='delete' class='itemDelete' onclick='return RemoveBranch();' tooltip='Remove Branch'>Remove</a></Li>"; 
       } 

Javascript 

function RemoveBranch() { 
    $('.itemDelete').live('click', function() { 
    $(this).closest('Li').remove(); 
    }); 

    return false; 
} 

當我使用live for上述方法時,它顯示錯誤,因爲對象不支持屬性或方法'live 」。我在我的應用程序中使用jquery-1.2.6.js,仍然無法使用實時方法

+0

爲什麼在函數內部有'.live()'?這將是一個奇怪的地方。你知道'.live()'是做什麼的嗎? –

+0

其實我在服務器端創建了一個動態按鈕,然後點擊那個按鈕我刪除了一些東西。 U可以檢查我的編輯帖子 –

+0

Live的工作是,它的使用就像一個選擇器,我想刪除特定的li,只需點擊 –

回答

0

live功能在1.3+版本中可用。

參考

https://api.jquery.com/live/

+0

thanx,但我可以使用任何其他的東西,而不是生活 –

+0

檢查了這一點http ://stackoverflow.com/questions/3408929/how-to-mimic-jquery-live-or-use-2-jquery-versions-in-the-presence-of-a-protot –

相關問題