I am having problem with fetching the text of the selected ActionLink
I am displaying the links dynamically after fetching through database like this:
@foreach (var item in Model)
{
<li>@Html.ActionLink(item.HobbyName, "Hobbies")</li>
}
Now, how shall I fetch the text of selected Link?
I tried this:
filename = $('a').text;
alert(filename);
But does not to work.
Please help me!
Use like this
text()is a function, not a property.EDIT:
If you want to get link text when you click in that link try like this