i have the following script inside my asp.net MVC application to bounce the image
$(document).ready(function () {
$("#to-get-bigger").mouseover(function () {
$(this).effect("bounce", { time: 3, distance: 40 });
});
});
and on the view i have the following two images with the same Id:-
<a href="@Url.Action("StartAssessment", "StartAssessment", new { assessmentid = Model.AssessmentID })"
onclick = "return confirm('This will make the Assessment avilable for the regestred user.')" >
<img id = "to-get-bigger" border="0" src="@Url.Content("~/content/images/assessment-button1.jpg")" alt="start assessment" />
</a>
<a href="@Url.Action("StartAssessment", "StartAssessment", new { assessmentid = Model.AssessmentID })"
onclick = "return confirm('This will make the Assessment avilable for the regestred user.')" >
<img id = "to-get-bigger" border="0" src="@Url.Content("~/content/images/assessment-button1.jpg")" alt="start assessment" />
</a>
But the problem is that the Jquery function will only execute and bounce one image while it will not work on the second image,, although i have read that the Jquery selector in this case the #to-get-bigger will return all the elements that have this ID and the Jquery function will be executed once the user move the mouse on any of the intended elements ?
BR
Having multiple elements with the same
idis invalid, and causes issues like this. Theidattribute should be unique. To reference multiple elements with a single attribute, use aclass:HTML
jQuery