Page 1 of 1

Updating radio group based on localstorage variable not working

Posted: Tue Jun 17, 2014 10:43 pm
by Aeneas McBurney

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!


Updating radio group based on localstorage variable not working

Posted: Wed Jun 18, 2014 12:49 am
by Yurii Orishchuk

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.


Updating radio group based on localstorage variable not working

Posted: Wed Jun 18, 2014 3:47 am
by Aeneas McBurney

Works a charm, thanks for your prompt reply!