运行 ❯
获取您的
自己的
网站
×
更改方向
保存代码
更改主题,深色/浅色
前往 Spaces
<!DOCTYPE html> <html> <body> Select your favorite fruit: <select> <option id="apple">Apple</option> <option id="orange">Orange</option> <option id="pineapple">Pineapple</option> <option id="banana">Banana</option> </select> <p>Click the button to change the text for the apple option in the dropdown list.</p> <button onclick="myFunction()">Try it</button> <script> function myFunction() { document.getElementById("apple").text = "newTextForApple"; } </script> </body> </html>