修改select选中项
/**
* 设置select选中
* @param selectId select的id值
* @param checkValue 选中option的值
*/
function setSelectChecked(selectId, checkValue){
var select = document.getElementById(selectId);
for(var i=0; i<select.options.length; i++){
if(select.options[i].innerHTML == checkValue){
select.options[i].selected = true;
break;
}
}
};
另外selectedindex; 这个属性是判断选中的是第几个options
修改select选中项的更多相关文章
- layui动态修改select的选中项
layui动态修改select的选中项:(在layUI下给select设置默认选项) 例: $("select[name='result']").val(11); //重新渲染表单 ...
- Jquery设置select控件指定text的值为选中项
<select name="streetid" id="streetid"> <option value="4">北 ...
- angularjs中设置select的选中项
最近用angularjs比较多,里面有很多自己的方法,都不咋会用,这篇只是个笔记,防止自己忘记 <select style="width:100%" ng-model=&qu ...
- 修改select下拉选的默认选中值
<!DOCTYPE html> <html> <head> <meta charset="utf-8" /> <title&g ...
- PHP 根据php传的值修改 select 中动态生成的 option 组的默认选中值
有一个情况今天遇到了:通过后台传过来的一组下拉框的option值,需要默认选中其中某一项. html 部分是这样的: <select class="form-control" ...
- angularjs ng-select ng-options 默认选中项.
<!DOCTYPE html> <html ng-app="myApp"> <head> <meta charset="utf- ...
- 使用val()方法设置表单中的默认选中项
有时候我们展示给用户的表单中的checkbox,radio,selec等标签的一些项是默认选中的.比方:当用户改动文章的时候,假设相应的栏目为下拉框的话,那么它的默认选中值应该是原来的栏目位置. 能够 ...
- CTreeCtrl点击获得选中项
相应TVN_SELCHANGED可以得到选中的项,在相应函数内如下: LPNMTREEVIEW pNMTreeView = reinterpret_cast<LPNMTREEVIEW>(p ...
- wpf中ListBox的选中项与ComboBox间的绑定
产品类: public class Product:NotificationObject { private int productID; public int ProductID { get { r ...
随机推荐
- CodeForces 710A King Moves
简单题. #pragma comment(linker, "/STACK:1024000000,1024000000") #include<cstdio> #inclu ...
- js 遍历json
JSON数据如:{"options":"[{/"text/":/"王家湾/",/"value/":/" ...
- GCD系列 之(二): 多核心的性能
全局队列的并发执行 for(id obj in array) [self doSomethingIntensiveWith:obj]; 假设,每个元素要做的事情-doSomethingIntensiv ...
- wall time
"showing elapsed time and wall clock time correspondingly." what's difference between elap ...
- python--day4--迭代器、生成器
列表生成式: 需求:列表[1,2,3,4,5,6,7,8,9]每个值加1,实现的方法: a = [0,1,2,3,4,5,6,7,8,9] b = [] for i in a:b.append(i+1 ...
- Inversions After Shuffle
Inversions After Shuffle time limit per test 1 second memory limit per test 256 megabytes input stan ...
- input 和raw_input
---恢复内容开始--- 因为看python2 和 3 混了,所以两者里面的东西有点乱input 和raw_input 今天终于搞明白了,在这里记录一下: 1.python 2 中raw_input ...
- google浏览器图标显示不正常怎么办
taskkill /f /im explorer.exe rem 清理系统图标缓存数据库 attrib -h -s -r "%userprofile%\AppData\Local\IconC ...
- 如何优化 App 的启动时间
http://www.cocoachina.com/ios/20161102/17931.html App 运行理论 main() 执行前发生的事 Mach-O 格式 虚拟内存基础 Mach-O 二进 ...
- Android中的eventBus传值
第一步:在build.gradle中添加依赖dependencies { compile 'org.greenrobot:eventbus:3.0.0'} 第二步:创建一个 Event类: 注意:en ...