javascript - How to uncheck a radio button? -


I have radio buttons that I want to submit using an Ajax form after the use of jQuery. I have the following functions:

  function clearForm () {$ ('# frm input [type = "text"]'). Each (function () {$ (this) .val ("");}); $ ('#frm input [type = "radio": checked' '). Each (function () {$ (this). Checked = false;}); }  

With the help of this function, I can clear the value on the text box, but I can not remove the values ​​of the radio button.

By the way, I also have $ (this) .value (""); , but it does not work.

Either (plain JS)

  this.checked = False;  

or (jQuery)

  $ (this) .prop ('check', wrong); // Note that pre-jQuery 1.6 idioms // $ (this) .attr ('checked', false); See for clarification on difference between attr ()  and  prop ()  and why Sahara () is now better. Br> prop () was introduced in May 2011 with jQuery 1.6. 


Comments

Popular posts from this blog

oracle - The fastest way to check if some records in a database table? -

php - multilevel menu with multilevel array -

jQuery UI: Datepicker month format -