gpt4 book ai didi

javascript - 如何通过弹出菜单中的选定选项更改进行设置?

转载 作者:行者123 更新时间:2023-11-28 05:15:37 24 4
gpt4 key购买 nike

我有这些选择:

<form>
<select id="poSelect" >
<option selected disabled>Choose here</option>
<option id="buyeroption" value="100101">I am a Buyer</option>
<option id="garageoption" value="100102">I am a Garage</option>
</select>

<label>Full Name</label>
<input type="text" />

<label>Email Address</label>
<input type="email" />

<label>Password</label>
<input type="password" />

<label id="industrylabel" >Select Your Brand</label>
<select id="industryoption">
<option selected disabled>Select</option>
<option value="Renault">Renault</option>
<option value="Pegaut">Pegaut</option>
<option value="Citroen">Citroen</option>
</select>

<div class="form-check-label">
<input id="send_updates" type="checkbox" />
<label for="send_updates">Send me occasional email updates</label>
</div>

所以我需要的是当用户选择我是买家标签“选择您的品牌”并且行业选项选择隐藏但当我点击我是车库时出现。

最佳答案

<form>
<select id="mySelect">
<option id="apple">Apple</option>
<option id="orange">Orange</option>
<option id="pineapple">Pineapple</option>
<option id="banana">Banana</option>
</select>
</form>
<p></p>

<button onclick="myFunction()">textbox1</button>
<p id="demo"></p>
<script>
function myFunction() {
var x = document.getElementById("mySelect").options.namedItem("banana").text;
document.getElementById("demo").innerHTML = x;
}
</script>

如果您想更改任何内容,也许您想要类似的东西,请检查此链接:- http://www.w3schools.com/jsref/tryit.asp?filename=tryjsref_select_options6

关于javascript - 如何通过弹出菜单中的选定选项更改进行设置?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/39332153/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com