网上找了好多帖子,都没用,在百度知道发现以下答案

知识点:使用 jq的prop才能设置

html

$('.ss').click(function(){
               $(this).find("input[type=radio]").attr("checked",true);
   });

<ul>
  <li class="ss"><input type="radio" name="radio" class="fc" id="radio" value="a" />fdfd</li>
  <li class="ss"><input type="radio" name="radio" class="fc" id="radio" value="b" />qqqq</li>
  <li class="ss"><input type="radio" name="radio" class="fc" id="radio" value="c" />wwww</li>
  </ul>

js

$('.ss').click(function(){
    var    $radio = $(this).find("input[type=radio]"),
           $flag  = $radio.is(":checked");
    if( !$flag ){
        $radio.prop("checked",true);   
    }
});

 

相关文章:

  • 2022-12-23
  • 2021-07-24
  • 2021-12-04
  • 2022-02-08
  • 2022-12-23
  • 2022-12-23
  • 2021-11-23
  • 2021-06-22
猜你喜欢
  • 2022-12-23
  • 2021-07-01
  • 2021-08-20
  • 2021-10-06
  • 2022-12-23
  • 2022-12-23
相关资源
相似解决方案