【发布时间】:2016-09-20 07:50:19
【问题描述】:
您好,我有一个 html,一开始我有下拉列表,如何根据下拉值的选择更改表单字段? 这是代码。就像我选择一般查询一样,它应该显示前 2 个表单域和一般 div 中的表单域
<form action="">
<select name="cases" id="cases">
<option value="general">General Inquiry</option>
<option value="credit">Credit Inquiry</option>
<option value="payment">Payment Issue</option>
</select><br>
<label for="email">Email Address <span>*</span></label>
<input type="text">
<label for="full name">Full Name <span>*</span></label>
<input type="text">
<div class="general" id="general">
<label for="documents">Wish to submit any requested documents?</label>
<input type="radio" name="radio">Yes
<input type="radio" name="radio">No <br><br>
<label for="select">How did you find out about us?<span>*</span></label><br>
<select name="case" id="case-type">
<option value="value1">Value 1</option>
<option value="value2">Value 2</option>
<option value="value3">Value 3</option>
</select><br>
</div>
<div class="credit" id="credit">
<label for="Date of Inquiry">Date of Inquiry<span>*</span></label>
<input type="date">
<label for="Agency">Agency 3 <span>*</span></label>
<input type="text">
</div>
<div class="payment" id="payment">
<label for="Service Phone Number">Service Phone Number<span>*</span></label>
<input type="text">
<label for="select">Topic<span>*</span></label><br>
<select name="case" id="case-type">
<option value="topic1">Topic 1</option>
<option value="topic2">Topic 2</option>
<option value="topic3">Topic 3</option>
</select><br><br>
</div>
<br><br>
<button>Submit</button>
</form>
如果我选择 Credit Inquiry 它应该显示前 2 个表单域和 credit div 中的表单域 如果我选择付款查询,它应该显示前 2 个表单字段和付款 div 中的表单字段
【问题讨论】:
-
您需要编写 javascript 函数来决定隐藏哪些文件和显示哪些文件。更改下拉菜单
-
是的,我需要决定该功能的 Javascript。
标签: javascript jquery html forms drop-down-menu