动态回显select中的option 动态添加selected属性
来源:互联网 发布:java excel文件预览 编辑:程序博客网 时间:2024/05/19 02:39
var id = ""; var name = ""; var selectedStarInfoId = '${starNews.starInfoId}';// alert(selectedStarInfoId); _findStarInfo(); function _findStarInfo(){ jQuery.ajax({ dataType: "json", url: "/starinfo/getStarInfo", data: null, type: "POST", success: function (result) { if (result.code == 1) { var $ele = $('#starInfoId') var data = result.data; data = data.starInfoIds; console.info(data); for(var i = 0; i < data.length; i++){ id = data[i].split("--")[0]; name = data[i].split("--")[1]; var obj = document.getElementById('starInfoId'); var _option = new Option(name,id);// console.info(_option);// console.info("selectedStarInfoId:" + selectedStarInfoId);// console.info("id:" + id); if(selectedStarInfoId == id){ _option.setAttribute("selected","true"); } obj.options.add(_option); //这个兼容IE与firefox } } } }); }
阅读全文
0 0
- 动态回显select中的option 动态添加selected属性
- 动态指定select option selected选中值
- select动态添加option与动态设置下拉框默认选项(selected)的问题(原创)
- 动态给option设置selected后,select下拉框显示不正确,selected=“selected”的option
- jquery select 动态添加option
- 动态添加select的option
- <select>里动态添加option
- <select>里动态添加option
- easyui select 动态添加 option
- <select>里动态添加option
- layui select动态添加option
- ie6中select标签动态插入选择项<option>后不能设置selected属性
- 怎么动态的设置select标签中option选项的selected属性
- JS动态添加与删除select中的Option对象
- ajax异步获取数据,动态添加select标签中的option
- 为select动态添加option问题
- select动态添加子选择项option
- JQuery动态添加Select的Option元素
- 面向对象
- Android 百度地图使用
- 最全三大框架整合(使用映射)——Dept.hbm.xml
- HTTP学习笔记(一)
- Android就业面试技巧系列-技术篇10 (图片OOM)
- 动态回显select中的option 动态添加selected属性
- LeetCode 63 Unique Paths II
- 用css画一辆小汽车
- 最全三大框架整合(使用映射)——IDeptDao.java
- html页面调用js文件里的函数报错onclick is not defined处理方法 (click)
- 编程第七十五天
- Android就业面试技巧系列-技术篇11 (支付相关)
- Android->Activity 学习
- 最全三大框架整合(使用映射)——DeptDaoImpl.java