-2

I have a div for showing the validation summary in MVC form. I have wrapped the validation messages with an anchor tag pointing to the form element. But this method doesn't work properly in IE. It seems to focus at that element, but goes to page top immediately.

Inside the div, I have a <ul> list which is dynamically appended on form submit. The code snippet in https://stackoverflow.com/a/12386332 replicates this issue. Please help to find a solution.

Thanks

Shwrk
  • 173
  • 11

1 Answers1

0

Well, I decided to drop the anchor tag and use the DOM scrollIntoView function.

Previously, I had linked to the element with

<a href="#elemAId"><li>error msg for elemA</li> </a> 

Now on click on <li>, I select the element with above ID and do

el.scrollIntoView();

this works for following browsers

Shwrk
  • 173
  • 11