简体   繁体   中英

Disable Imagebutton on button click in asp.net using Javascript or Jquery

How to disable/enable dynamically created ImageButton in asp.net using Javascript or Jquery? I am creating a imagebutton and i want to disable it on button click. If anybody understand then please answer my question. Thanks in advance.....

You can use bellow code for that

  • .aspx

    <asp:ImageButton id="imgButton" runat="server" ImageUrl="~/Images/img1.jpg" /> <asp:Button id="btnClick" runat="server" Text="Click"/>

  • JavaScript

    `

     $(document).ready(function () { $('#<%= btnClick.ClientID %>').click(function () { $('#<%= imgButton.ClientID %>').attr('disabled', 'disabled'); // Image Button Id which you want to disable. }); }); 

    `

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM