0

I'm trying to set a PuiRadioButton to checked but I've encountered a problem. The underlying pure HTML input elements gets selected, but PrimeUI does not show the change.

I've the two elements:

<input type="radio" name="peopleSelection" id="peopleRadioButton" value="people" checked="checked" />

and

<input type="radio" name="peopleSelection" id="groupRadioButton" value="group" />

and I've tried following statement

$('#groupRadioButton').attr('checked', 'checked');

It works perfetly fine in a JSFiddle. But when I inspect the HTML, the correct input element is checked successfully, but not shown by PrimeUI.

I also tried variations of these:

$('#groupRadioButton').prop('checked', true);
$('#groupRadioButton').attr('checked', 'checked');
$('#groupRadioButton')[0].checked = true;

Unfortunately I could not find a set or get method on the PrimeUi Documentation page.

How do select/unselect PrimeUI radio buttons?

Thanks in advance

Manuel
  • 3,828
  • 6
  • 33
  • 48
  • Your fiddle doesn't use the library! Try triggering the `.change()` event after changing the property, `$('#groupRadioButton').prop('checked', true).change();` – Ram Jan 21 '14 at 18:27
  • I know. I just wanted to demonstrate the jquery code I used. I wasnt able to include primeui lib into the JSFiddle. – Manuel Jan 21 '14 at 21:48
  • Thank you @BlackSheep. If you create an answer for that I'll accept it. – Manuel Jan 22 '14 at 08:04

0 Answers0