easyui radio select 默认选中

chenluozhi 2013-01-11 01:59:27
<label >月计划</label>	
<input type="radio" id="planType" name="planType" value="0" checked="true"/>
<label >周计划</label>
<input type="radio" id="planType1" name="planType" value="0"/>



<select id="cc" name="dept" style="width:200px;">

<option value="aitem1">aitem1</option>

<option value="bitem2" selected="selected">bitem2</option>

</select>

就这几行代码,粘贴到html 上是没问题的,但是在引入easyui 脚本之后,就感觉失效了!easyui 到底做了什么手脚呀,大伙帮帮忙咯
哎。。。
...全文
17668 12 打赏 收藏 转发到动态 举报
AI 作业
写回复
用AI写文章
12 条回复
切换为时间正序
请发表友善的回复…
发表回复
qq_15547417 2014-10-31
  • 打赏
  • 举报
回复
$('input[name=cariibearstate]').get(0).checked = true; cariibearstate是radio的name;把这句话放到js的窗口加载的那个方法里就行了,比如 $(window).load(function(){ $('input[name=cariibearstate]').get(0).checked = true; });
1598583 2014-09-18
  • 打赏
  • 举报
回复
我也遇到同样问题,结论是怎么样的?怎么样才能设置默认值?
SeverHo 2014-04-25
  • 打赏
  • 举报
回复
你要这样写……

<script type="text/javascript">
$('[name="planType"]:radio').each(function() {   
                if (this.value == '0'){   
                   this.checked = true;   
                }       
             });   
 </script>
xugan666 2014-02-24
  • 打赏
  • 举报
回复
这个我知道原因,是因为你在form表单里面,所以会出现样式没有选中状态,必须要从后台去获取数据,然后再绑定。也就是初始化数据。 我是这样处理的。
shun12321 2013-08-30
  • 打赏
  • 举报
回复
发现都起不了作用 纠结 把样式去掉又好了
shun12321 2013-08-30
  • 打赏
  • 举报
回复
$(function(){ var input = $("td").find("input[type='radio']"); input.each(function(){ if($(this).val()=='${counse.istrue}'){ $(this).attr("checked",true); } }); var selSorts = $("td").find("select[id='education'] option"); selSorts.each(function(){ if($(this).val()=='${counse.education}'){ $(this).attr("selected",true); } }); $('#education').combobox('selectedIndex',2) });
熊柏棠 2013-06-20
  • 打赏
  • 举报
回复
结贴了? 我也遇到这个问题,请问楼主是怎么解决的呢~
  • 打赏
  • 举报
回复
没见你设置dom对象的easyui class属性和对应的属性,easyui不会修改dom对象的,应该你其他代码有问题。 发客户端最后生成的html代码看看
chenluozhi 2013-01-11
  • 打赏
  • 举报
回复
引用 2 楼 hujife 的回复:
引用 楼主 chenluozhi 的回复: XML/HTML code?1234567891011121314<label >月计划</label> <input type="radio" id="planType" name="planType" value="0" checked="true"/><label >周计划</label> <input type="radio" id……
没效果喔
chenluozhi 2013-01-11
  • 打赏
  • 举报
回复
引用
引用 1 楼 showbo 的回复:
失效是什么意思。。。最好贴全你代码。
就是不能默认选中了。我打开页面,要默认选中其中一项的。现在,都没有选中。 代码已经补全了,就差几句引入 easyui 库的代码; 给你也没用: <%@ include file="/common/meta.jsp"%> <%@ include file="/common/loading.jsp"%>
tcpfeng 2013-01-11
  • 打赏
  • 举报
回复
引用 楼主 chenluozhi 的回复:
XML/HTML code?1234567891011121314<label >月计划</label> <input type="radio" id="planType" name="planType" value="0" checked="true"/><label >周计划</label> <input type="radio" id="planType……
放到一个DIV里试试
  • 打赏
  • 举报
回复
失效是什么意思。。。最好贴全你代码。

87,996

社区成员

发帖
与我相关
我的任务
社区描述
Web 开发 JavaScript
社区管理员
  • JavaScript
  • 无·法
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧