Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to apply on change event on radio button using jquery

HTML:

<div class="radio-list  ">
     <label class="radio-inline">
     <span class=""><input type="radio" name="data[Customer][service_type]" id="service_type" value="new" checked=""></span> NEW INSTALLATION </label>
     <label class="radio-inline">
     <span class="checked"><input type="radio" name="data[Customer][service_type]" id="service_type" value="repair"></span> SERVICE REPAIR </label>
  <label class="radio-inline">
  <span class="checked"><input type="radio" name="data[Customer][service_type]" id="service_type" value="cancel"></span> CANCEL SERVICE </label>
  <label class="radio-inline">
  <span class="checked"><input type="radio" name="data[Customer][service_type]" id="service_type" value="other"></span> OTHER SERVICE </label>
</div>

How to apply on change event on <input type="radio" name="data[Customer][service_type]" id="service_type" value="cancel"> ?

like image 401
Abdus Sattar Bhuiyan Avatar asked Nov 14 '15 06:11

Abdus Sattar Bhuiyan


1 Answers

$(function(){

    $("input:radio[name='data[Customer][service_type]']").change(function(){
        var _val = $(this).val();
        console.log(_val);
    });

});

.change is the event which you need to trigger.

See it here.

like image 158
void Avatar answered Sep 28 '22 02:09

void