You need to sign in to do that
Don't have an account?
Sadik Shaik 3
I got this popup that when you scroll down to the bottom of the page and click the close button, it scrolls the user to the top of the page.
Close link code in java script:
<a href=\"#\" onclick=\"box.hide();\">Close</a>
I would like the user to not get redirected to the top of the page after close. how do we do that?
Thanks in advance
<a href=\"#\" onclick=\"box.hide();\">Close</a>
I would like the user to not get redirected to the top of the page after close. how do we do that?
Thanks in advance
Greetings to you!
The jump-to-top was just the default browser behavior. You need to call event.preventDefault() in your onClick handler.
Or you can use something like this.
<a href="#" onClick={event => {event.preventDefault(); box.hide();}}>Close</a>
Refer below links for more information:
https://github.com/reactjs/react-modal/issues/117#issuecomment-333409035
https://stackoverflow.com/questions/265478/preventdefault-on-an-a-tag
I hope it helps you.
Kindly let me know if it helps you and close your query by marking it as solved so that it can help others in the future. It will help to keep this community clean.
Thanks and Regards,
Khan Anas
All Answers
Greetings to you!
The jump-to-top was just the default browser behavior. You need to call event.preventDefault() in your onClick handler.
Or you can use something like this.
<a href="#" onClick={event => {event.preventDefault(); box.hide();}}>Close</a>
Refer below links for more information:
https://github.com/reactjs/react-modal/issues/117#issuecomment-333409035
https://stackoverflow.com/questions/265478/preventdefault-on-an-a-tag
I hope it helps you.
Kindly let me know if it helps you and close your query by marking it as solved so that it can help others in the future. It will help to keep this community clean.
Thanks and Regards,
Khan Anas
<a href=\"#bottom\" onclick=\"box.hide();\">Close</a>
Thanks for your involvement to reslove this issue.