您现在的位置: 爱51代码网 >> 范文 >> 文章正文
jquery指定单选框选择没有反应

jquery指定单选框选择没有反应

<input id="postRadio" type="radio" name="type" value="1" onclick="changePushWin(this.value);" checked="checked"/>帖子
<span id="custmoerRadioDiv" style="display:none;">
<input id="houseRadio" type="radio" name="type" value="2" onclick="changePushWin(this.value);" style="margin-left: 20px;"/>房源
<input id="communityradio" type="radio" name="type" value="3" onclick="changePushWin(this.value);" style="margin-left: 20px;"/>小区
</span>

第一次执行
$("#communityradio").attr("checked",true); 小区选中没问题,
第二次执
$("#houseRadio").attr("checked",true); 房源选中没问题
第三次执
$("#postRadio").attr("checked",true); 让其选中帖子他就没反应
执行
$("#houseRadio").attr("checked",false); 取消选中房源,再执行$("#houseRadio").attr("checked",true);选择房源还是没效果
这到底是什么原因?
<span id="custmoerRadioDiv" style="display:none;">//这里隐藏下面房源小区选项???
<input id="houseRadio" type="radio" name="type" value="2" onclick="changePushWin(this.value);" style="margin-left: 20px;"/>房源
<input id="communityradio" type="radio" name="type" value="3" onclick="changePushWin(this.value);" style="margin-left: 20px;"/>小区
</span>
至于你radio选项上的onclick事件要做什么操作,请说明

第一次执行
$("#communityradio").attr("checked",true); 小区选中没问题,
第二次执
$("#houseRadio").attr("checked",true); 房源选中没问题
第三次执
$("#postRadio").attr("checked",true); 让其选中帖子他就没反应
执行
$("#houseRadio").attr("checked",false); 取消选中房源,再执行$("#houseRadio").attr("checked",true);选择房源还是没效果
上面这些执行,都没问题,关键是你这在什么地方执行

请使用
$("#houseRadio").prop("checked")

并且使用jquery1.6以后的版本

attr在不同的浏览器中不好使用

  • 上一篇文章:

  • 下一篇文章: 没有了
  • 最新文章 热点文章 相关文章
    SharePoint 2013 Search REST AP
    SharePoint如何搜索指定的爬网内
    weblogic Servlet: "action" fai
    webdav 与exchange通信失败未找到
    SharePoint2013文档库可以直接存
    Unable to write data to the tr
    asp.net中listbox的items.count属
    C#不是每次查询数据是不是被缓存
    ASP.NET发布后能加载引用的js文件
    Hadoop2.2.0在eclipse控制台没有
    SharePoint 2013 Search REST AP
    SharePoint如何搜索指定的爬网内
    weblogic Servlet: "action" fai
    webdav 与exchange通信失败未找到
    SharePoint2013文档库可以直接存
    Unable to write data to the tr
    asp.net中listbox的items.count属
    C#不是每次查询数据是不是被缓存
    ASP.NET发布后能加载引用的js文件
    Hadoop2.2.0在eclipse控制台没有
    银联接口只返回给前台数据Bg
    easyui datagrid连续删除行问
    Unexpected exception parsi
    jquery ajax的发生错误error
    60行代码网页版俄罗斯方块
    保留小数点后两位然后将其转
    如何根据设备显示定制的网页
    如何让html生成app
    jQuery Autocomplete not wo
    xml取不到createElement后的
     



    设为首页 | 加入收藏 | 网站地图 | 友情链接 |