JQuery 获取select被选中的value和text
html代码:
<select name="test" >
<option value="0">请选择</option>
<option value="1">test1</option>
<option value="2">test2</option>
</select>
jq代码:
//获取select被选中的value
$("select[name='test']").val();
//获取select被选中的text
$("select[name='test'] option:selected").text();
JQuery 获取select被选中的value和text的更多相关文章
- 使用JavaScript获取select元素选中的value和text
示例代码如下(js直接写在了html里面,没有写在一个单独的外部文件中): <!DOCTYPE html> <html> <head> <meta name= ...
- jquery 获取select框选中的值示例一则
$('#MODULE_TYPE').change(function(){ var moduleType=$(this).children('option:selected').val();//这就是s ...
- jQuery获取Select元素
jQuery获取Select元素,并选择的Text和Value: 1. $("#select_id").change(function(){//code...}); //为Se ...
- Jquery获取select选中的文本与值
jquery获取select选择的文本与值获取select :获取select 选中的 text : $("#ddlregtype").find("option:s ...
- jQuery获取Select选中的Text和Value,根据Value值动态添加属性
语法解释:1. $("#select_id").change(function(){//code...}); //为Select添加事件,当选择其中一项时触发2. var chec ...
- jQuery获取Select选中的Text和Value,根据Value值动态添加属性等
语法解释:1. $("#select_id").change(function(){//code...}); //为Select添加事件,当选择其中一项时触发2. var ch ...
- jquery获取select选中的值
http://blog.csdn.net/renzhenhuai/article/details/19569593 误区: 一直以为jquery获取select中option被选中的文本值,是这样写的 ...
- 用jquery获取select标签中选中的option值及文本
<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding= ...
- jquery获取select选中的文本值
误区: 一直以为jquery获取select中option被选中的文本值,是这样写的: $("#id").text(); //获取所有option的文本值 实际上应该这样: ...
随机推荐
- py三个面试小问题
1.是否遇到过Python的模块间循环引用的问题,如何避免它? 这是代码结构设计的问题,模块依赖和类依赖,如果老是觉得碰到循环引用可能的原因有几点: a.可能是模块的分界线划错地方了 b.可能是把应该 ...
- selenium启动Firefox失败
今天搭建java+selenium环境,搭建几次都失败,总结一下原因 1. selenium启动Firefox,不需要额外的driver 2. Friefox如果没有安装到默认路径C盘,代码中需要修改 ...
- python基础(4)-元组&字典&字符串&队列
元组(tuple) #元组相对列表来说不同之处是只读不可写 读操作和列表一致 letter_tuple = ('a','b','c','d'); print(letter_tuple[0]);#res ...
- Tomcat不加项目名称访问设置
一.Tomcat不加项目名称访问设置 一.方法一:修改配置文件server.xml 1.修改配置文件server.xml <Host appBase="webapps" au ...
- 《linux就该这么学》第十节课:第8章iptables和firewalld
网卡配置: 物理机:192.168.10.1/24 服务器:192.168.10.10/24 客户端:192.168.10.20/24 1.vim /etc/sysc ...
- windows程序设计 获取显示器分辨率
我的显示器分辨率 /*--------------------------------------------------------------------------- scrsize.c -- ...
- android layout文件优化
性能优化1--UI优化 1.使用系统为我们提供了几个抽象的标签①include:重用include中layout属性指定一个外部布局文件,通过该方式则不需要把这个布局文件在该代码中重复的写一遍了. 若 ...
- MySQL数据排序asc、desc
数据排序 asc.desc1.单一字段排序order by 字段名称 作用: 通过哪个或哪些字段进行排序 含义: 排序采用 order by 子句,order by 后面跟上排序字段,排序字段可以放多 ...
- 用 python 生成一个简单的词云图
import jieba from nltk import * from wordcloud import WordCloud import matplotlib.pyplot as plt word ...
- Linux:command not found
最近老是遇到command not found 这个问题,然后就上网查到什么文件底下export什么变量啊.后来次数多了,发现不对劲.后来上网查了一下,原来切换到root用户要使用su -,而不是su ...