Change LinkButton Text OnClientClick using JavaScript

Last Reply 2 months ago By pandeyism

Posted 2 months ago

hello,

i want to write processing onclient click not sure why this is not working

  <asp:LinkButton ID="LinkButton1" runat="server" OnClientClick="{ return false; } this.disabled = true; this.value = 'Processing...';">LinkButton</asp:LinkButton>

 

Posted 2 months ago Modified on 2 months ago

Hi nauna,

Refer below sample.

HTML

<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
    <title></title>
    <script type="text/javascript" src="https://ajax.googleapis.com/ajax/libs/jquery/1.9.1/jquery.min.js"></script>
    <script type="text/javascript">
        function changeText() {
            $("[id*=LinkButton1]")[0].innerText = "Processing...";
            return false;
        }     
    </script>
</head>
<body>
    <form id="form1" runat="server">
    <div>
        <asp:LinkButton ID="LinkButton1" OnClientClick="javascript:return changeText()" runat="server">LinkButton</asp:LinkButton>
    </div>
    </form>
</body>
</html>

Screenshot