我试图通过JavaScript修改第一个选择选项的文本.但它清空了整个选择选项
 <select name='stuff'>
      <option value="a"> Pepsi </option>
      <option value= "b"> Juice </option>
 </select>
<script type="text/javascript">
    document.getElementsByName('stuff')[0].innerHTML = "Water";
</script>
Cod*_*gue 19
您想要从选项集合中读取并修改其中的第一个元素:
document.getElementsByName('stuff')[0].options[0].innerHTML = "Water";
你可以试试这个:
 $('select[name=stuff] option:first').html("abcd");