I have a button on my webpage which when onClick I want it to show another div. However when I click the button it will flash in the url that it went to the correct div but then it will immediately redirect back to the main div, #home.
Code for button:
<input type="button" class="flip" value="Redirect To Div" onClick="window.location='#targetDiv'" />
When I click the the button the url will flash:
http://www.XXXXX.com/#targetDiv
Then go immediately to http://www.XXXXX.com/#home
Any ideas why it won’t display the div?
Thanks
looks like your form has
or
instead of onclick call a function
…
or if your form is irrelevent set it’s action and remove the javascript allogether
but then all you would need is actually this ..
if by “go to another div” you mean jump and scroll the page to a new location it is actually an anchor you need to go to