A.M.K
A.M.K

Reputation: 16795

How can I add custom HTML attributes to an ASP.NET label without code-behind access?

I am making some modifications to a website, but it is hosted by a third party so I don't have code-behind access, how can I add custom HTML attributes (Rich Snippets) to an ASP label or other element?

Code: <asp:Label ID="lblPositionTitle" runat="server"></asp:Label>

Thank you in advance

Upvotes: 2

Views: 2491

Answers (3)

dlchambers
dlchambers

Reputation: 3752

Is using HTML5, you can use the data-* attribute: https://www.w3schools.com/tags/att_global_data.asp

Upvotes: 0

danielQ
danielQ

Reputation: 2086

Is jquery available? ... just add the attribute like:

<script> 

$("#<%=lblPositionTitle.ClientID%>").attr("newAttributeName", "theValue"); 

</script> 

Upvotes: 0

Ivo
Ivo

Reputation: 8352

I think this will work:

<asp:Label ID="lblPositionTitle" runat="server" richAttribute="value"></asp:Label>

Upvotes: 2

Related Questions