Pra*_*A R -1 html javascript validation jquery
我有两个选择元素.如果从第一个中选择"2 Wheeler" <select>,我希望下一个列表自动验证并显示"2个轮子".
我怎样才能做到这一点?
这是我的代码;
<form method="post" id="target">
<select id ="selected1" name="expenseType" class="dynamic_select" >
<option value="0">-select-vehicle-type-</option>
<option value="1">2 Wheeler</option>
<option value="2">4 Wheeler</option>
</select>
<select id ="selected2" name="expenseType" class="dynamic_select" >
<option value="0">-select-Parts-</option>
<option value="1">2 wheels and Parts</option>
<option value="2">4 wheels and Parts</option>
</select>
<input type="submit" value="submit"/>
</form>
Run Code Online (Sandbox Code Playgroud)
验证是使用jQuery完成的.
这很简单,因为你已经使用了jQuery;
$("#selected1").change(function(){
$("#selected2").val($(this).val());
});
Run Code Online (Sandbox Code Playgroud)
点击此处查看JS Fiddle http://jsfiddle.net/qjvzw/
| 归档时间: |
|
| 查看次数: |
2294 次 |
| 最近记录: |