简体   繁体   中英

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! :)

任何属性都应添加在元素的<>开头对(标记符号之后的任何位置)内:

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

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM