的html代碼:jQuery的Asp.net按鈕禁用
<asp:Button runat="server" ID="btnTest" Text="Test" OnClick="btnTest_Click" />
jQuery代碼:
$('[id$=btnTest]').click(function(){
$('[id$=btnTest]').attr('disabled', 'true');
});
代碼隱藏:
protected void btnTest_Click(object sender, EventArgs e)
{
//here not come.
}
代碼爲btnTest事件背後不行?
你需要知道你的'在JS按鈕ClientID'。它與ID不同,但是像'ctl00_Content1_btnTest',如果你使用masterpage的話。 – 2010-05-25 14:57:06
問題是你必須設置'disabled =「disabled」'屬性而不是'disabled =「true」'。 – 2010-05-25 15:01:04