• jquery获取type=radio属性的值


      获取选中的值

      1、$('input:radio:checked').val();

      2、$("input[type='radio']:checked").val();

      3、$("input[name='rd']:checked").val();

      设置第一个为选中的值

      $("input[name='rd']:checked").val(); 或是

      $('input:radio:first').attr('checked', 'true');

      存在多个 input type=radio  的情况下,则用监听事件监听用户选择具体选项,

       var index = $(event.currentTarget).index("input[type=radio]");
       $(".forline").eq(0).find("input").eq(index).attr("checked", true).siblings("input").attr("checked",false);

  • 相关阅读:
    POJ 2154
    POJ 1286
    Polycarp's problems
    Greedy Change
    Goods transportation
    Ugly Problem
    Happy Matt Friends
    Dense Subsequence
    Ray Tracing
    Batch Sort
  • 原文地址:https://www.cnblogs.com/duxingdexin/p/9115183.html
Copyright © 2020-2023  润新知