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

软件发布|下载排行|最新软件

当前位置:首页IT学院IT技术

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

  2020-05-12 我要评论
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 2022 版权所有 软件发布 访问手机版

声明:所有软件和文章来自软件开发商或者作者 如有异议 请与本站联系 联系我们