基于Jquery的將DropDownlist的選中值賦給label的實(shí)現(xiàn)代碼
更新時(shí)間:2011年05月06日 14:43:52 作者:
使用Jquery 將DropDownlist的選中值賦給label的代碼,需要的朋友可以參考下。
jquery代碼
$(function() {
$("#DropDownList1").bind("change", function() {
$("#Label1").text($("#DropDownList1 option:selected").text());
});
或者
$("#DropDownList1").bind("change", function() {
$("#Label1").text($("#DropDownList1").val());
});
其中對這個(gè)解釋下:
var name = $("#DropDownList1 option:selected").val(); //獲取dropdownlist 里面選中的值
var name1 = $("#DropDownList1").text(); //獲取dropdownlist 里面所用的值
復(fù)制代碼 代碼如下:
$(function() {
$("#DropDownList1").bind("change", function() {
$("#Label1").text($("#DropDownList1 option:selected").text());
});
或者
復(fù)制代碼 代碼如下:
$("#DropDownList1").bind("change", function() {
$("#Label1").text($("#DropDownList1").val());
});
其中對這個(gè)解釋下:
var name = $("#DropDownList1 option:selected").val(); //獲取dropdownlist 里面選中的值
var name1 = $("#DropDownList1").text(); //獲取dropdownlist 里面所用的值
相關(guān)文章
JQuery給元素添加/刪除節(jié)點(diǎn)比如select
本教程詳細(xì)介紹下jQuery添加/刪除Select的Option項(xiàng),感興趣的各位可以參考下哈2013-04-04jquery自動切換tabs選項(xiàng)卡的具體實(shí)現(xiàn)
這篇文章主要介紹了jquery自動切換tabs選項(xiàng)卡的具體實(shí)現(xiàn),有需要的朋友可以參考一下2013-12-12jQuery中調(diào)用WebService方法小結(jié)
以前在寫ajax請求時(shí),總是喜歡使用jQuery+ashx的方式進(jìn)行調(diào)用,今天采取jQuery+WebService的方法來做ajax請求,發(fā)現(xiàn)這種方式比使用ashx的方式要更方便。2011-03-03