In jQuery, how do I select an element by its name attribute?

I have 3 radio buttons in my web page, like below: <label for=”theme-grey”> <input type=”radio” id=”theme-grey” name=”theme” value=”grey” />Grey</label> <label for=”theme-pink”> <input type=”radio” id=”theme-pink” name=”theme” value=”pink” />Pink</label> <label for=”theme-green”> <input type=”radio” id=”theme-green” name=”theme” value=”green” />Green</label> In jQuery, I want to get the value of the selected radio button when any of these three are clicked. … Read more

How to get value of selected radio button?

I want to get the selected value from a group of radio buttons. Here’s my HTML: <div id=”rates”> <input type=”radio” id=”r1″ name=”rate” value=”Fixed Rate”> Fixed Rate <input type=”radio” id=”r2″ name=”rate” value=”Variable Rate”> Variable Rate <input type=”radio” id=”r3″ name=”rate” value=”Multi Rate” checked=”checked”> Multi Rate </div> Here’s my js: var rates = document.getElementById(‘rates’).value; var rate_value; if(rates ==’Fixed … Read more

How to bind RadioButtons to an enum?

I’ve got an enum like this: public enum MyLovelyEnum { FirstSelection, TheOtherSelection, YetAnotherOne }; I got a property in my DataContext: public MyLovelyEnum VeryLovelyEnum { get; set; } And I got three RadioButtons in my WPF client. <RadioButton Margin=”3″>First Selection</RadioButton> <RadioButton Margin=”3″>The Other Selection</RadioButton> <RadioButton Margin=”3″>Yet Another one</RadioButton> Now how do I bind the RadioButtons … Read more

How to uncheck a radio button?

I have group of radio buttons that I want to uncheck after an AJAX form is submitted using jQuery. I have the following function: 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 values at the text boxes, but I can’t … Read more