Joofe Kopp
Joofe Kopp

Reputation: 123

How to set a radiobutton active in jQuery radiobutton group

I am trying to set a radiobutton active with the standart jQuery function like in this demo if you do a onclick event.

http://jqueryui.com/button/#radio

I wanna do the same that onclick does but not on click, i wanna do this in a function that is called.

Tried this but it is not working right:

function checkradio() {
    $("#labelRADIOVU").button("enable");
    $('#RADIOVU').prop('checked', true);
    //alert($("input[name='']:checked").val())
    document.getElementById("labelRADIOVU").style.color = "white";
    document.getElementById("labelRADIOVU").style.backgroundColor = "red";
    //document.getElementById("RADIOVU").checked = true;
};

Upvotes: 0

Views: 86

Answers (1)

7h4ro3
7h4ro3

Reputation: 123

You can trigger the click on radio

 $('#RADIOVU').trigger('click')

Example: http://jsfiddle.net/nZLeU/

Upvotes: 1

Related Questions