DEV Community

Discussion on: Star-Rating Using A Single Input

Collapse
 
glebskozlovskis profile image
Glebs Kozlovskis

Dears, is it possible to add and url to each of the stars, so when you click on it - it opens an url?

Collapse
 
madsstoumann profile image
Mads Stoumann

No, sorry, that would require a different solution.

Collapse
 
jamievaughn profile image
Jamie Vaughn

You could add a click listener that checks the value on click and accessing some url by index based on the value: for example: (e) => window.open(urls[e.target.value])

Collapse
 
madsstoumann profile image
Mads Stoumann • Edited

Or the “change” or “input” events, ie input.addEventListener('change', event => { do something with input.value })