Reputation: 16795
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
Reputation: 3752
Is using HTML5, you can use the data-* attribute: https://www.w3schools.com/tags/att_global_data.asp
Upvotes: 0
Reputation: 2086
Is jquery
available?
... just add the attribute like:
<script>
$("#<%=lblPositionTitle.ClientID%>").attr("newAttributeName", "theValue");
</script>
Upvotes: 0
Reputation: 8352
I think this will work:
<asp:Label ID="lblPositionTitle" runat="server" richAttribute="value"></asp:Label>
Upvotes: 2