Quantcast
Channel: How to check a radio button with jQuery? - Stack Overflow
Browsing index pages (34 articles)

How to check a radio button with jQuery?

I try to check a radio button with jQuery. Here's my code:<form><div id='type'><input type='radio' id='radio_1' name='type' value='1' /><input type='radio' id='radio_2' name='type'...

View Article


Answer by Mike Thomsen for How to check a radio button with jQuery?

For versions of jQuery equal or above (>=) 1.6, use:$("#radio_1").prop("checked", true);For versions prior to (<) 1.6, use:$("#radio_1").attr('checked', 'checked');Tip: You may also want to call...

View Article


Answer by JohnP for How to check a radio button with jQuery?

You have to do jQuery("#radio_1").attr('checked', 'checked');That's the HTML attribute

View Article

Answer by dominicbri7 for How to check a radio button with jQuery?

$("#radio_1").attr('checked', true);//or$("#radio_1").attr('checked', 'checked');

View Article

Answer by Umesh Patil for How to check a radio button with jQuery?

One more function prop() that is added in jQuery 1.6, that serves the same purpose.$("#radio_1").prop("checked", true);

View Article


Answer by Petr Lazarev for How to check a radio button with jQuery?

Short and easy to read option:$("#radio_1").is(":checked")It returns true or false, so you can use it in "if" statement.

View Article

Answer by Vladimir Djuricic for How to check a radio button with jQuery?

Try this.In this example, I'm targeting it with its input name and value$("input[name=background][value='some value']").prop("checked",true);Good to know: in case of multi-word value, it will work...

View Article

Answer by Lakshmana Kumar for How to check a radio button with jQuery?

Try this.To check Radio button using Value use this.$('input[name=type][value=2]').attr('checked', true); Or$('input[name=type][value=2]').attr('checked',...

View Article


Answer by user2190046 for How to check a radio button with jQuery?

Try thisvar isChecked = $("#radio_1")[0].checked;

View Article


Answer by Amin Saqi for How to check a radio button with jQuery?

The $.prop way is better:$(document).ready(function () { $("#radio_1").prop('checked', true); });and you can test it like the following:$(document).ready(function () { $("#radio_1, #radio_2",...

View Article

Answer by pst for How to check a radio button with jQuery?

try this $("input:checked", "#radioButton").val()if checked returns Trueif not checked returns FalsejQuery v1.10.1

View Article

Answer by user3721473 for How to check a radio button with jQuery?

Try This:$(document).ready(function(){ $("#Id").prop("checked", true).checkboxradio('refresh');});

View Article

Answer by Anjana Silva for How to check a radio button with jQuery?

If property name does not work don't forget that id still exists. This answer is for people who wants to target the id here how you...

View Article


Answer by Pankaj Bhagwat for How to check a radio button with jQuery?

Some times above solutions do not work, then you can try...

View Article

Answer by Jordan Jelinek for How to check a radio button with jQuery?

Try this$(document).ready(function(){ $("input[name='type']:radio").change(function(){ if($(this).val() == '1') { // do something } else if($(this).val() == '2') { // do something } else...

View Article


Answer by azim hamdan for How to check a radio button with jQuery?

I got some related example to be enhanced, how about if I want to add a new condition, lets say, if I want colour scheme to be hidden after I click on project Status value except Pavers and Paving...

View Article

Answer by Eray for How to check a radio button with jQuery?

$("input[name=inputname]:radio").click(function() { if($(this).attr("value")=="yes") { $(".inputclassname").show(); } if($(this).attr("value")=="no") { $(".inputclassname").hide(); }});

View Article


Answer by user4457035 for How to check a radio button with jQuery?

Try This:$("input[name=type]").val(['1']);http://jsfiddle.net/nwo706xw/

View Article

Answer by Naim Serin for How to check a radio button with jQuery?

Get value:$("[name='type'][checked]").attr("value");Set value: $(this).attr({"checked":true}).prop({"checked":true});Radio Button click add attr checked:$("[name='type']").click(function(){...

View Article

Answer by UWU_SANDUN for How to check a radio button with jQuery?

We should want to tell it is a radio button.So please try with following code.$("input[type='radio'][name='userRadionButtonName']").prop('checked', true);

View Article
Browsing index pages (34 articles)


Latest Images