最新消息: 新版网站上线了!!!

jquery 获取单选框radio的值

html
  1. <form> 
  2. <input type="radio" name="category" value="doctor" /> Doctor 
  3. <input type="radio" name="category" value="police" checked /> Policia 
  4. </form> 

js
 

  1. var category = null
  2. $("input[name='category']").click(function() { 
  3.     category = this.value; 
  4.     alert(category); 
  5. }); 

 

转载请注明:谷谷点程序 » jquery 获取单选框radio的值