我有一個表,我通過.live()的每一行jQuery的 - 禁用現場點擊事件特別是TD
查看在指定click事件給每個TD(ID = 「分」):
<td id="min">
@Html.Action("GetMinAmount", "Stock", new { id = item.FoodID })
</td>
控制器(鈕顯示圖像或量)
// Function to return min amount, if null return "-"
public string GetMinAmount(int id)
{
var food = dbEntities.FOODs.Single(f => f.FoodID == id);
string output = "";
if (food.MinAmount == null)
{
output += "<img id=\"disable\" src=\"../../Content/Add_in_Images/disable.png\" alt=\"disable\" style=\"background-image: none\"/>";
}
else
{
return food.MinAmount.ToString();
}
return output;
}
腳本:
$('#min').live('click', function() { $editdialog.dialog('open'); });
但TD,我可以有2個條件裏面,一個是「啓用」狀態,這顯示金額在那裏用戶可以點擊和編輯的數量。如果金額爲零,則會顯示一個圖標,用戶無法對其執行任何操作。
目前我不能刪除單擊處理殘疾人的形象。因此,即使其想禁用的TD是可點擊也...
我不知道如何刪除單擊處理爲「已禁用」只有TD。
任何人都可以幫助???謝謝.......
我只是重讀,你可以針對ID,但ID都是唯一的,我:可能出現的問題,使用.prop()代替建議你用clas替換它們SES。 – jackJoe