Click here to Skip to main content
15,911,039 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
hi,
i want to call javascript on click of this label
ASP.NET
<asp:Label ID="splitral" runat="server"  />

This label is inside repeater. on cick of this label i just want to get the text of label.
Thank you
Posted
Updated 23-May-13 2:28am
v2

You can use like

ASP.NET
<asp:label id="splitral" runat="server" onclick="alert(this.innerText);"/>

or using jQuery
ASP.NET
<asp:label id="splitral" runat="server" onclick="alert($(this).text());"/>

Thanks,
Imdadhusen
 
Share this answer
 
v3
innerText will not work in FireFox.

So, use innerHTML instead. It will be cross browser.
XML
<asp:Label ID="splitral"
           runat="server"  
           onclick="javascript:alert(this.innerHTML)">
</asp:Label>
 
Share this answer
 
v2

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900