Receive radiobutton



  • There are two radioctops.

    <input type="radio" id="c1" name="cc" checked="" />
    <label for="c1"><span></span>&nbsp;государственные</label>
    <input type="radio" id="c2" name="cc" />
    <label for="c2"><span></span>&nbsp;частные</label>
    

    At a certain event (when scrubbing the slider), I have to get the chosen value of the radiocnopy, how do I do it through jquery?

    UPD

    Who's gonna get a scrulling code?

    <script>
        $(function () {
          $("#range").ionRangeSlider({
            type: "double",
            grid:true,
            min: 1,
            max: 5,
            from: 1,
            to: 5,
            step: 1,
            onFinish: function (data) {
              titleSearch = $("#titleSearch").val();
              typeSearch = $("#typeSearch").val();
    
          $.ajax({
            type: 'POST',
            url: '/ajax/searchResult',
            data : {
              'min':data.from,
              'max':data.to,
              'titleSearch':titleSearch,
              'typeSearch':typeSearch
            },
            success: function(answer) {
              $(".searchResult").slideDown(500);
            }
          });
    
          console.log(data.from);
          console.log(data.to);
    
        }
      });
    });
    

    </script>



  • Getting your chosen radioctopus is pretty easy.

    $('input[name=cc]:checked')
    

    For each radio, add atribut. value with unique significance for his identification.

    The selected value is:

    $('input[name=cc]:checked').val()
    

Log in to reply
 


Suggested Topics

  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2