+ 3
How do I properly select the datalist for styling?
5 ответов
+ 4
Boyan Ivanov
https://code.sololearn.com/WRsrSXohwwq3/?ref=app
Hope this will help you
+ 3
<!DOCTYPE html>
<html>
<head>
<title>Page Title</title>
</head>
<body>
<h6>select who is the best?</h6>
<!--give a id of select-->
<select id="player">
<datalist id="players" class="a">
<option value="neymar">Neymar</option>
<option value="messi">Messi</option>
<option value="ronaldo">Ronaldo</option>
</datalist>
</select>
<button>Submit</button>
<!--put a js-->
<script>
let dt = document.querySelector("#player")
dt.style.color="red"
</script>
</body>
</html>
+ 3
thank you guys, amazing!
+ 2
Ashwin Maurya I tried both but it doesn't work
+ 1
Boyan Ivanov
Give it a class or id as per your need and use that id or class in applying css to it,or can directly use the tags to give them css