Tuesday, June 2, 2009

Jquery : Load page at specific position

In our project, we needed to load a page if we get errors once form is submitted. So I used the href of an anchor tag which was a link with in page to the div I wanted to be on the top on page load.

< script type="text/javascript" src="jquery.js">< /script >

< a href="#status" id="linkWithInAPage">< /a>

< div id="status">
...
< /div>

< script>
jQuery(document).ready(function(){
window.location.href = jQuery("#linkWithInAPage").attr('href');
});
< /script>



Cheers!

~~Amit Jain~~
amitjain1982@gmail.com

No comments:

Post a Comment