Help on Html, Js onclick respones

Hello,

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.

Thanks!

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.

2 Likes

Okay here is where i tried it.

This demo site

When i tap on the star it scrolls upwards.

Thanks.

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

Thanks.

good job!

happy coding!