I have a form in a jQuery dialog box named "login". In JavaScript, I detect if "#login" is in the URL -- if so, it displays the login dialog box. In FF/Safari/Chrome it works fine, but in IE6/7 the browser page jumps down to the top of the form when the dialog box is displayed. I would like to prevent this from happening.
I found what looked like an answer to my question here, which gives this example code:
$('a.anchor').remove().prependTo('body');
I changed "a.anchor" to "form.anchor", but it doesn't work correctly. When I first load mydomain/#login IE still jumps down to the top of the form. Then if I refresh the page it again displays the dialog box but doesn't jump down.
Any idea how to globally just prevent IE from jumping to any form/anchor names?