Assign Text to LinkButton on Click using jQuery in ASP.Net

Last Reply 27 days ago By pandeyism

Posted 27 days ago

How to assign value to linkbutton on client click

 <asp:LinkButton ID="LinkButton1" runat="server" onclientclick="javascript:return disablethis()" Text="register"  ></asp:LinkButton>

 

<script language="javascript" type="text/javascript">
    function disablethis()
    {
        $("[id*=LinkButton1]").val = "Processing...";
    }
</script>

 

Posted 27 days 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 language="javascript" type="text/javascript">
        function disablethis() {
            $("[id*=LinkButton1]")[0].innerText = "Processing...";
            return false;
        }     
    </script>
</head>
<body>
    <form id="form1" runat="server">
    <div>
        <asp:LinkButton ID="LinkButton1" runat="server" OnClientClick="javascript:return disablethis()"
            Text="register"></asp:LinkButton>
    </div>
    </form>
</body>
</html>

Screenshot