jquery获取dropdownlist的value和text值
2014-05-26 16:41
260 查看
<script type="text/javascript">
$(function () {
$("#Educations").change(function () {
var EducationText = $('#Educations option:selected').text(); //获取学历的text值
$("#Education").val(EducationText); //把获取的值赋值给text文本框
})
$("#Politicals").change(function () {
var PoliticalText = $('#Politicals option:selected').val(); //获取政治面貌的value的值
$("#Political").val(PoliticalText); //把获取的值赋值给text文本框
})
})
</script>
<div>
@Html.DropDownList("Educations", null, "-请选择-", new { style = "width:120px" })
<input type="text" name="Education" id="Education"/>
@Html.DropDownList("Politicals", null, "-请选择-", new { style = "width:120px" })
<input type="text" name="Political" id="Political"/>
</div>
$(function () {
$("#Educations").change(function () {
var EducationText = $('#Educations option:selected').text(); //获取学历的text值
$("#Education").val(EducationText); //把获取的值赋值给text文本框
})
$("#Politicals").change(function () {
var PoliticalText = $('#Politicals option:selected').val(); //获取政治面貌的value的值
$("#Political").val(PoliticalText); //把获取的值赋值给text文本框
})
})
</script>
<div>
@Html.DropDownList("Educations", null, "-请选择-", new { style = "width:120px" })
<input type="text" name="Education" id="Education"/>
@Html.DropDownList("Politicals", null, "-请选择-", new { style = "width:120px" })
<input type="text" name="Political" id="Political"/>
</div>
相关文章推荐
- jquery获取ASP.NET服务器端控件dropdownlist和radiobuttonlist生成客户端HTML标签后的value和text值
- JS获取DropDownList的value值与text值
- JS获取DropDownList的value值与text值
- 通过jQuery来获取DropDownList的Text/Value属性值
- JS获取DropDownList的value值与text值
- 通过jQuery来获取DropDownList的Text/Value属性值
- ASP.NET jQuery 实例7 通过jQuery来获取DropDownList的Text/Value属性值
- JS获取DropDownList的value值与text值
- jquery获取ASP.NET服务器端控件dropdownlist和radiobuttonlist生成客户端HTML标签后的value和text值
- JS获取DropDownList的value值与text值.txt
- js获取<select>标签value值及text值
- jQuery获取Radio选择的Value值:
- jQuery获取Select选择的Text和 Value(转)
- 通过js获取DropDownList控件的Value值
- jQuery获取Radio选择的Value值:
- jQuery获取Select选中的Text和Value(jquery学习备忘录)
- 可编辑的下拉框,以及js获取DropDownList的Text和Value
- JS获取DropDownList的value与text值
- 可编辑的下拉框,以及js获取DropDownList的Text和Value
- 关于jquery获取input的value问题