Aeneas McBurney
Posts: 0
Joined: Mon Jun 16, 2014 7:49 am

Updating radio group based on localstorage variable not working

var rad=$('input:radio[name=mobileradiogroup_1]:checked');

if(localStorage.getItem('Side')=='buy')
{rad.val('2');
}
else
{rad.val('1');}

This is not changing the option value so am hoping you can help with this.

Thanks!

Yurii Orishchuk
Posts: 0
Joined: Fri Feb 14, 2014 8:20 am

Updating radio group based on localstorage variable not working

Hi Aeneas.

Please use following code:

pre

//Note: you should replace "mobileradiogroup_17" with your mobileRadioButtonGroup component block.
var mobileRadioGroupComponentName = "mobileradiogroup_17";

//This is your radio component value that's you need to bee checked.
var valueNeedToBeSelected = "Item 1";

Apperyio(mobileRadioGroupComponentName).find('input[value="' + valueNeedToBeSelected + '"]').prop("checked", true).trigger("click");

/pre

Regards.

Aeneas McBurney
Posts: 0
Joined: Mon Jun 16, 2014 7:49 am

Updating radio group based on localstorage variable not working

Works a charm, thanks for your prompt reply!

Return to “Issues”