获取select标签的值
1、设置value为pxx的项选中
$(".selector").val("pxx");
2、设置text为pxx的项选中
$(".selector").find("option[text='pxx']").attr("selected",true);
这里有一个中括号的用法,中括号里的等号的前面是属性名称,不用加引号。很多时候,中括号的运用可以使得逻辑变得很简单。
3、获取当前选中项的value
$(".selector").val();
4、获取当前选中项的text
$(".selector").find("option:selected").text();
获取select标签的值的更多相关文章
- Jquery获取select标签的值、文本方式
<script> function add(){ var prop_name=$("#prop").find("option:selec ...
- 获取select标签选中状态 的label的值。
<select name="procode" onchange="alert(this.options[this.selectedIndex].text)" ...
- 获取select标签选中的值
js获取select标签选中的值 var obj = document.getElementById(”testSelect”); var index = obj.selectedIndex; var ...
- 用jquery获取select标签中选中的option值及文本
<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding= ...
- JS实现选择不同select标签option值的验证
js实现不同select标签option值的验证 功能描述: 选择中文时,匹配中文的正则表达式,选择英文选项是匹配英文的表达式,并且有对应的提示信息. html代码片段: <select id= ...
- jquery获取select选中的值
http://blog.csdn.net/renzhenhuai/article/details/19569593 误区: 一直以为jquery获取select中option被选中的文本值,是这样写的 ...
- js获取select标签选中的值[转]
var obj = document.getElementByIdx_x(”testSelect”); //定位id var index = obj.selectedIndex; // 选中索引 va ...
- JQ获取选中select 标签的值
Jq://#ses为select 标签的Id$("#ses option:selected").val(); $("#ses option:selected") ...
- JS获取select选中的值,所有option值
<select name="myselect" id="myselect"> <option value="2042"&g ...
随机推荐
- delphi中线程应用之Synchronize
当一个线程在使用时,如果这个函数使用了Synchronize修钸的话就不允许别一个线程来调用这个函数,它的目的是避免多个子线程同时访问主线程资源.示例:procedure TTaskThread.Sh ...
- Coding源码学习第一部分(AppDelegate.m)
前言:在此首先感谢开源,感谢大神们的无私分享. Coding 的主页:https://coding.net/app#app-feature Coding 自己家的仓库:https://coding.n ...
- Python学习06——列表的操作(2)
笨办法学Python第39节 之前用的第三版的书,昨天发现内容不对,八块腹肌又给我下了第四版,这次的内容才对上.本节的代码如下: ten_things = "Apples Oranges C ...
- Spring init-method和destroy-method 的使用
Spring init-method和destroy-method 的使用 Spring 为了满足开发者在执行某方法之前或者在结束某个任务之前需要操作的一些业务,则提供了init-method和des ...
- 解决iis+php+mysql访问速度慢的方法
IIS7.5网站访问PHP响应慢的原因原因是PHP5.3以上支持IPv6协议,但是大家的服务器未使用IPv6,当访问PHP的时候会连接MySQL的地址为localhost,系统会会先用IPv6连接,但 ...
- C#中Thread与ThreadPool的比较
最近同事在编写一个基于UPD RTP协议的通信软件,在处理接收Listen时,发现了一个问题到底是用Thread还是ThreadPool呢? 我看同事的问题比较有典型性,还是做以整理培训一下吧 Thr ...
- Oracle查询表空间使用情况
--查询表空间使用情况 SELECT UPPER(F.TABLESPACE_NAME) "表空间名", D.TOT_GROOTTE_MB "表空间大小(M)", ...
- Raspberry Pi Resources-Using the UART
参考:RPi Serial Connection 本文来自:http://www.raspberry-projects.com/pi/programming-in-c/uart-serial-port ...
- python 类以及单例模式
python 也有面向对象的思想,则一切皆对象 python 中定义一个类: class student: count = 0 books = [] def __init__(self ...
- hdu 1231, dp ,maximum consecutive sum of integers, find the boundaries, possibly all negative, C++ 分类: hdoj 2015-07-12 03:24 87人阅读 评论(0) 收藏
the algorithm of three version below is essentially the same, namely, Kadane's algorithm, which is o ...