Jquery中select使用

select获取当前选中的value

$(‘#DDLDEP‘).change(function () {  var depId = $(this).children(‘option:selected‘).val();
});

select根据当前的text设置选中项

$("#DDLDEP option[text=‘当前文本‘]").attr("selected", true);
时间: 2024-08-26 06:22:18

Jquery中select使用的相关文章

Jquery中select的操作

jQuery获取Select选择的Text和Value:语法解释:1. $("#select_id").change(function(){//code...});    //为Select添加事件,当选择其中一项时触发2. var checkText=$("#select_id").find("option:selected").text();   //获取Select选择的Text3. var checkValue=$("#sele

js、jquery中select的用法

1.js var obj=document.getElementById(selectid); obj.options.length = 0; //清除所有内容 obj.options[index] = new Option("three",3); //更改对应的值 obj.options[index].selected = true; //保持选中状态 obj.add(new Option("4","4")); ”文本",”值&quo

总结jquery中对select和option的基本操作

jQuery获取Select选择的Text和Value:$("#select_id").change(function(){//code...}); //为Select添加事件,当选择其中一项时触发 var checkText=$("#select_id").find("option:selected").text(); //获取Select选择的Text var checkValue=$("#select_id").val(

JQuery操作select中的option

html页面代码如下: <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv=&q

Jquery操作select选项集合,判断集合中是否存在option

转载:http://www.cnblogs.com/pepcod/archive/2012/07/03/JavaScript.html Query获取Select选择的Text和Value: 语法解释: 1. $("#select_id").change(function(){//code...}); //为Select添加事件,当选择其中一项时触发 2. var checkText=$("#select_id").find("option:selecte

JQuery中对Select的option项的添加、删除、取值

jQuery获取Select选择的Text和Value: $("#select_id").change(function(){//code...}); //为Select添加事件,当选择其中一项时触发 var checkText=$("#select_id").find("option:selected").text(); //获取Select选择的Text var checkValue=$("#select_id").val

Jquery获取html中select,radiobutton选中的值写法

1.Html代码: <select name="" class="qixian" id="tbCheckCycleUnit"> <option value="1">天</option> <option value="2">月</option> <option value="3">年</option> &l

jquery操作select(取值,设置选中)

最近工作中总出现select 和 option问题,整理一下,内容大部分源于网络资料 一.基础取值问题 例如<select class="selector"></select> 1.设置value为pxx的项选中 $(".selector").val("pxx"); 2.设置text为pxx的项选中 $(".selector").find("option[text='pxx']").

jQuery获取Select选择的Text(非表单元素)和 Value(表单元素)(转)

jQuery获取Select选择的Text和Value: 语法解释: 1. $("#select_id").change(function(){//code...}); //为Select添加事件,当选择其中一项时触发 2. var checkText=$("#select_id").find("option:selected").text(); //获取Select选择的Text 3. var checkValue=$("#selec