惯性聚合 高效追踪和阅读你感兴趣的博客、新闻、科技资讯
阅读原文 在惯性聚合中打开

推荐订阅源

freeCodeCamp Programming Tutorials: Python, JavaScript, Git & More
腾讯CDC
cs.AI updates on arXiv.org
cs.AI updates on arXiv.org
L
LINUX DO - 热门话题
D
Darknet – Hacking Tools, Hacker News & Cyber Security
Project Zero
Project Zero
V
Vulnerabilities – Threatpost
Cisco Talos Blog
Cisco Talos Blog
P
Palo Alto Networks Blog
C
Cisco Blogs
A
Arctic Wolf
月光博客
月光博客
The GitHub Blog
The GitHub Blog
T
The Blog of Author Tim Ferriss
量子位
小众软件
小众软件
Latest news
Latest news
OSCHINA 社区最新新闻
OSCHINA 社区最新新闻
Microsoft Security Blog
Microsoft Security Blog
T
The Exploit Database - CXSecurity.com
Security Latest
Security Latest
N
Netflix TechBlog - Medium
K
Kaspersky official blog
人人都是产品经理
人人都是产品经理
Cyber Security Advisories - MS-ISAC
Cyber Security Advisories - MS-ISAC
博客园_首页
Y
Y Combinator Blog
P
Proofpoint News Feed
H
Hackread – Cybersecurity News, Data Breaches, AI and More
M
MIT News - Artificial intelligence
T
Threat Research - Cisco Blogs
S
Schneier on Security
D
Docker
Scott Helme
Scott Helme
MyScale Blog
MyScale Blog
Spread Privacy
Spread Privacy
cs.CL updates on arXiv.org
cs.CL updates on arXiv.org
Threat Intelligence Blog | Flashpoint
Threat Intelligence Blog | Flashpoint
GbyAI
GbyAI
有赞技术团队
有赞技术团队
Google DeepMind News
Google DeepMind News
The Hacker News
The Hacker News
H
Help Net Security
Simon Willison's Weblog
Simon Willison's Weblog
J
Java Code Geeks
C
Cyber Attacks, Cyber Crime and Cyber Security
T
Tenable Blog
B
Blog
Know Your Adversary
Know Your Adversary
IT之家
IT之家

博客园 - liufei

阿里云服务器访问不了外网 MySQL修改root密码的多种方法 为需要远程登录的用户赋予权限: C#生成电子印章源码 ASP.NET的优点 Android上传 apk格式文件下载 Could not load file or assembly 'System.Core, Version=2.0.5.0 和autofac冲突的问题 1130 - Host '' is not allowerd to connect to this MySQL server, HTTP 错误 500.21 - Internal Server Error 解决方案 . 修改SQL Service数据库排序规则 MSSQL获取昨天,本周,本月。。。 MySQL Packets larger than max_allowed_packet are not allowed asp.net Mvc Npoi 导出导入 excel 骗子手机 15311888578 北京高德豪门网络科技有限公司 面试题 JetBrains ReSharper 8.2 Build 8.2.0.2160 && StyleCop win7开启特定端口 asp.net发布到IIS中出现错误:处理程序“PageHandlerFactory-Integrated”在其模块列表中有一个错误模块“ManagedPipelineHandler” System.Core, Version=2.0.5.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e, Retargetable=Yes”
jquery关于select框的取值和赋值
liufei · 2014-08-19 · via 博客园 - liufei

jQuery("#select_id").change(function(){}); // 1.为Select添加事件,当选择其中一项时触发     

var checkValue = jQuery("#select_id").val(); // 2.获取Select选中项的Value  

var checkText = jQuery("#select_id :selected").text(); // 3.获取Select选中项的Text   

var checkIndex = jQuery("#select_id").attr("selectedIndex");// 4.获取Select选中项的索引值,

或者:jQuery("#select_id").get(0).selectedIndex;  

var maxIndex = jQuery("#select_id :last").attr("index");  // 5.获取Select最大的索引值,

或者:jQuery("#select_id :last").get(0).index;

jQuery("#select_id").get(0).selectedIndex = 1; // 1.设置Select索引值为1的项选中  

jQuery("#select_id").val(4);  // 2.设置Select的Value值为4的项选中

$("#select_id").attr("value","Normal“);

$("#select_id").get(0).value = value;

//根据select的显示值来为select设值

var count=$("#select_id").get(0).options.length;

for(var i=0;i<count;i++){

if($("#select_id").get(0).options[i].text == text)  

{

$("#select_id").get(0).options[i].selected = true;          

break;  

}  

}

jQuery("#select_id").append("<option value='新增'>新增option</option>"); // 1.为Select追加一个Option(下拉项)   

jQuery("#select_id").prepend("<option value='请选择'>请选择</option>"); // 2.为Select插入一个Option(第一个位置)  

jQuery("#select_id").get(0).remove(1);  // 3.删除Select中索引值为1的Option(第二个)  

jQuery("#select_id :last").remove();  // 4.删除Select中索引值最大Option(最后一个)   

jQuery("#select_id [value='3']").remove(); // 5.删除Select中Value='3'的Option   

jQuery("#select_id").empty();   // 6.清空下拉列表