I have a Html Action link like below.
<div class="mylink"> @Html.ActionLink("SEARCH NOW", "MscHome", new { @id = "anu" }, new { @class = "linkone" })</div>
I need to get its id
and set up a new one using jquery.first I tried to get the id and show it as and alert.but it shows undefined
$(".linkone").mouseenter(function () {
//tried both ways
alert($(this).id);
var myval = $(".linkone").attr('id');
alert(myval);
});
I edited your code and it work well:
@Html.ActionLink("SEARCH NOW", "MscHome",new { }, new { @class = "linkone",@id = "anu" })
$(".linkone").mouseenter(function () {
alert($(this).attr("id"));
});