联系我们
简单又实用的WordPress网站制作教学
当前位置:网站首页 > 网页前端技术 > 正文

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

作者:98wpeu发布时间:2026-07-16分类:网页前端技术浏览:6


导读:JQuery代码复制代码代码如下:$(function(){$("#DropDownlist1").bind("change",function(){$("#labe...
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 里面所用的值

标签:代码WeblabelDropDownlistJquery


网页前端技术排行
最近发表
网站分类
标签列表