jquery - on getting the value of a radio button -


i ask what's wrong code, seems legit me.

when select radio button, radiomininum still remains 0.

var radiominimum=0;  $('#mmininum').click(function(){         if($(this).is(':checked')){             radiominimum = 1;             alert(radiominimum);         }         else{             radiominimum=0;             alert(radiominimum);         } });  alert(radiominimum); 

inside if-else radiominimum displays correctly. if checked,its 1. bottom alert-outside .click radiominimum still displays 0.

everything appears working expected:

var radiominimum = 0;    $('#mmininum').click(function(){          if($(this).is(':checked')){              radiominimum = 1;              console.log(radiominimum);          }          else{              radiominimum=0;              console.log(radiominimum);          }  });
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script>  <input type="checkbox" id="mmininum">minimum</input>


Comments

Popular posts from this blog

java - SSE Emitter : Manage timeouts and complete() -

jquery - uncaught exception: DataTables Editor - remote hosting of code not allowed -

java - How to resolve error - package com.squareup.okhttp3 doesn't exist? -