$("#select_id option[text='jQuery']").attr("selected", true) 失效

text是Jquery关键字,不太灵光.可以给select的option设置别的属性如"name”然后在设置

 

解决方法:

 

<select name="selInvoiceInfo" id="selInvoiceInfo">

        <option value="1" name="中国北京公司11118888">中国北京公司11118888</option>

        <option value="2" name="中国北京公司111122222">中国北京公司111122222</option>

        <option value="3" name="和发票信息名字相同的售达方" selected="selected">和发票信息名字相同的售达方</option>

        <option value="4" name="中国北京公司111122222">中国北京公司111122222</option>

</select>

<script src="~/Scripts/jquery-1.8.2.js"></script>

$("#selInvoiceInfo option[name='和发票信息名字相同的售达方']").attr("selected", true); //设置Select的Text值为jQuery的项选中

jQuery根据文本设置select选中失效问题的更多相关文章

  1. 【jquery】jquery 在 ie6 下无法设置 select 选中的解决方法

    本文主要解决在 ie6 下,jquery 无法设置 select 选中的问题.我们先看个例子: <!DOCTYPE HTML> <html lang="en-US" ...

  2. jquery设置select选中

    /*设置select选中开始*/ var prod_type=$('.prod_type').val(); //alert(prod_type); var select = document.getE ...

  3. jquery 获取和设置 select下拉框的值(转手册)

    ##实例应用中遇到的问题 //在某事件响应的应用中设置select选中项,前两种情况的设置不生效,使用了最后一种用法才生效的 //$("#select_time").find(&q ...

  4. jquery 获取和设置 select下拉框的值

    获取Select : 获取select 选中的 text : $("#ddlRegType").find("option:selected").text(); ...

  5. JQuery获取和设置select下拉框的值

    获取Select : 获取select 选中的 text : $("#sid").find("option:selected").text(); 获取selec ...

  6. JQuery获取与设置select

    获取select : 1.获取select 选中的 text :    $("#ddlregtype").find("option:selected").tex ...

  7. JQuery获取和设置Select选项常用方法总结 (转)

    1.获取select 选中的 text: $("#cusChildTypeId").find("option:selected").text(); $(&quo ...

  8. JQuery获取和设置Select选项常用方法总结

    1.获取select 选中的 text: $("#cusChildTypeId").find("option:selected").text(); $(&quo ...

  9. jquery 获取和设置Select选项常用方法总结

    1.获取select 选中的 text:$("#cusChildTypeId").find("option:selected").text();$(" ...

随机推荐

  1. 12-28 显示团购数据界面的搭建,cell的自定义方面的知识总结

    1.通过plist加载模型数据 2.controller中懒加载数据 3.设置tableView的数据源 4.写数据源的方法 5.观察演示项目,分析通过默认的cell的4种现实方式,无法实现要想要的现 ...

  2. The ShortCuts in the ADT (to be continued)

    1. automatically add all the namespace which need to be include in the class. ctrl+shift+o

  3. 转载大神的dfs讲解

    http://acm.hdu.edu.cn/forum/read.php?tid=6158 看完明白了好多! 关于剪枝,没有剪枝的搜索不太可能,这题老刘上课的时候讲过两个剪枝,一个是奇偶剪枝,一个是路 ...

  4. UVA 1639(组合数学)

    根据组合数公式C(m,n),由于m可能达到20万,因此转换为ln,之后可以表达为ln(m!)-ln(n!)-ln((m-n)!); 求每一个c[n]时,也要根据杨辉三角求组合数进行转化. 注意long ...

  5. 【LeetCode OJ】Word Break II

    Problem link: http://oj.leetcode.com/problems/word-break-ii/ This problem is some extension of the w ...

  6. 【题解】【排列组合】【回溯】【Leetcode】Gray Code

    The gray code is a binary numeral system where two successive values differ in only one bit. Given a ...

  7. python 怎样使用安装库

    win: 1.使用匹配安装 进入pip所在目录C:\Python27\Scripts pip intasll lxml 2.源码下载安装 下载源码,解压到任意目录 cd 进入到setup.py的目录 ...

  8. java类型转化之Hbase ImmutableBytesWritable类型转String

    Hbase 的ImmutableBytesWritable类型一般作为RowKey的类型;但也有时候会把值读出来;故有了转化为string一说. ImmutableBytesWritable RowK ...

  9. 了解 C++ 默默编写并调用的函数

    前言 对于一个类来说,最最基础的三类成员函数莫过于:构造函数,析构函数以及拷贝函数 (copy构造函数和=重载函数).即使你的类没有为这些函数做出定义,C++ 也会自动为你创建.本文将讲述的是 C++ ...

  10. UVa 1346 - Songs

    题目大意:n张唱片,每张都有长度和频率,要求题目中公式值最小.求一个排序,输出该排序下第m张CD的id. 思路:贪心,长度越长放越后面,频率越低放越后面,所以按len/p去排序即可. #include ...