您好,欢迎来到尚车旅游网。
搜索
您的当前位置:首页基于Jquery的将DropDownlist的选中值赋给label的实现代码_jquery

基于Jquery的将DropDownlist的选中值赋给label的实现代码_jquery

来源:尚车旅游网

jquery代码
代码如下:
$(function() {
$("#DropDownList1").bind("change", function() {
$("#Label1").text($("#DropDownList1 option:selected").text());

});

或者
代码如下:
$("#DropDownList1").bind("change", function() {
$("#Label1").text($("#DropDownList1").val());
});

其中对这个解释下:

var name = $("#DropDownList1 option:selected").val(); //获取dropdownlist 里面选中的值
var name1 = $("#DropDownList1").text(); //获取dropdownlist 里面所用的值

Copyright © 2019- sceh.cn 版权所有 湘ICP备2023017654号-4

违法及侵权请联系:TEL:199 1889 7713 E-MAIL:2724546146@qq.com

本站由北京市万商天勤律师事务所王兴未律师提供法律服务