如何在ie7中使用jquery启用禁用的单选按钮 [英] How do you enable a disabled radio button using jquery in ie7

查看:86
本文介绍了如何在ie7中使用jquery启用禁用的单选按钮的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

这适用于Firefox。如何使它在IE7中工作?

  $('#addressSection input:radio').attr('disabled',假); 

我也试过这些无济于事:

  $('#addressSection input:radio').removeAttr(disabled); 

$('#addressSection input:radio').attr('disabled','false');

$('#addressSection input:radio').attr({disabled:false});

$('#addressSection input:radio').attr({disabled:'false'});

以下是单选按钮html,因为它是由IE7呈现的。

 < div id =addressSection> 
< div class =column>
< ul class =simpleForm>
< li>
< input id =addressUseUorAname =addressUseUorAvalue =Utype =radiotype =textvalue =/>
< label for =addressUseUorA>使用用户地址< / label>
< input id =addressUseUorAname =addressUseUorAvalue =Atype =radiotype =textvalue =/>
< label for =addressUseUorA>使用帐户地址< / label>
< / li>
< / ul>
< / div>
< / div>

更新:

问题。



我禁用了这个字段,试图禁用DIV中的所有字段:

  $('#addressSection').attr('disabled',true); 

这导致ie7中出现问题,但不是Firefox。



当我将禁用代码更改为:

  $('#addressSection input')时,问题就解决了。 attr('disabled',true); 

我的猜测是disable属性应用于div而不是字段,所以不能通过引用单选按钮删除。



感谢您提供的所有帮助。

您是否尝试过:

  $('#addressSection input [type =radio]').removeAttr 禁用); 


This works in Firefox. How can I make it work in IE7?

$( '#addressSection input:radio' ).attr( 'disabled', false );

I've also tried these to no avail:

$( '#addressSection input:radio' ).removeAttr( "disabled" );

$( '#addressSection input:radio' ).attr( 'disabled', 'false' );

$( '#addressSection input:radio' ).attr( {disabled: false} );

$( '#addressSection input:radio' ).attr( {disabled: 'false'} );

Here's the radio button html as it is rendered by IE7. The original is written in Spring and custom tags.

<div id="addressSection">
  <div class="column">
    <ul class="simpleForm">
      <li>
        <input id="addressUseUorA" name="addressUseUorA" value="U" type="radio" type="text" value=""/>
        <label for="addressUseUorA">Use User Address</label>
        <input id="addressUseUorA" name="addressUseUorA" value="A" type="radio" type="text" value=""/>
        <label for="addressUseUorA">Use Account Address</label>
     </li>
   </ul>
 </div>
</div>

UPDATE:

Here's what was causing the issue.

I disabled the field like this, trying to disable all fields in the DIV:

$( '#addressSection' ).attr( 'disabled', true);

This causes an issue in ie7, but not firefox.

The issue was resolved when I changed the disable code to:

$( '#addressSection input' ).attr( 'disabled', true);

my guess is that the disable attribute was applied to the div and not the field and so could not be removed by referencing the radio button.

Thanks for all of the help.

解决方案

did you try:

$( '#addressSection input[type="radio"]' ).removeAttr( "disabled" );

这篇关于如何在ie7中使用jquery启用禁用的单选按钮的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆