Home › Forums › JavaScript › Unable to store radio button value in localStorage › Reply To: Unable to store radio button value in localStorage
September 28, 2016 at 3:36 pm
#245988
Alex Zaworski
Participant
I think this is what’s causing your problem:
$.each($('.stored'), function() {
if(localStorage[$(this).attr('name')]) {
$(this).val(localStorage[$(this).attr('name')]);
}
});
Since all of your radio inputs (correctly) have the same name
, this is causing each of them to be set to the same value
. Here’s a dev tools screenshot showing the issue: