Jordan1993
Jordan1993

Reputation: 822

How to add ID proprety to asp.net MVC link element

I have the following link <a href="@planUrl">@ResourceManager.GetResource("MemberLinkText")</a> in my web application and I want to add an id to this link so that I can add a $(document).onClick() handler. However I can't seem to find a way to add an ID to this type of link. I have tried:

<a href="@planUrl">@ResourceManager.GetResource("MemberLinkText") id="id"</a> and <a href="@planUrl"> id="id" @ResourceManager.GetResource("MemberLinkText")</a>

I am very new to this syntax and would be grateful for any help. Thank you! :)

Upvotes: 0

Views: 131

Answers (1)

Mamun
Mamun

Reputation: 68933

Any attribute should be added inside the opening pair of <> (any where after tag symbol) of the element:

<a href="@planUrl" id="myLink">@ResourceManager.GetResource("MemberLinkText")</a>

Upvotes: 2

Related Questions