Help on Html, Js onclick respones


I tried this snippet from this site

So when i click on the star the site scrolls upward
I need help on it as i just want it to remain at its position after i clicked on it.


why don’t you post your demo? there is not enough content in the page you posted for it to scroll upward, the behavioru you sau us not present

1 Like

I’m not sure what the problem is (see post above me) but after you click on a star, some text appears that wasn’t there before. So of course that changes the position of the rating stars, because the text now takes up some space above it. If you don’t want that to happen, you could (for example) give the text element a height, so that it takes up space even if it’s empty.


Okay here is where i tried it.

This demo site

When i tap on the star it scrolls upwards.


you will also need to provide the code of the page…

Oh thanks! I have fixed it ! Thanks.
I changed the css top and left values of the rating stars as instructed here


good job!

happy coding!