「red」ではなく「赤」という文字列を表示するにはどうすればよいですか?

option タグの value 属性を変更してみましょう。
2021年9月5日
ユーザー

こんにちは。
Select で選択した「赤」、「青」、「黄」を表示させるのかと思ったら、redblue、yellow の表示で
驚きました。
「赤」、「青」、「黄」を表示させる方法はありますか?

document.querySelector('button').addEventListener('click', ()=> {
   const li = document.createElement('li');
   const color = document.querySelector('select');
  // li.textContent = `${color.value} - ${color.selectedIndex}`;
   li.textContent = color.value;
   document.querySelector('ul').appendChild(li);
 });

では blue と表示されました。

この回答を見るにはプレミアムプランへの登録が必要です

プレミアムプランとは?