Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR JAVASCRIPT

Save multiple radios checked on LocalStorage

<div><b>Favorite sport :</b>
  <input type="radio" id="basketball" name="sport" value="basketball" checked="checked">
  <label for="basketball">basketball</label>
  <input type="radio" id="football" name="sport" value="football">
  <label for="football">football</label>
  <input type="radio" id="handball" name="sport" value="handball">
  <label for="handball">handball</label><br>
</div>
<div><b>Favorite fruit :</b>
  <input type="radio" id="banana" name="fruit" value="banana" checked="checked">
  <label for="banana">banana</label>
  <input type="radio" id="apple" name="fruit" value="apple">
  <label for="apple">apple</label>
  <input type="radio" id="pear" name="fruit" value="pear">
  <label for="pear">pear</label>
  <input type="radio" id="raspberry" name="fruit" value="raspberry">
  <label for="raspberry">raspberry</label><br>
</div>
<div><b>Favorite ... :</b> other radios ...<br><br>
</div>
<input onclick="saveFav()" type="button" value="Save favorite">
<input onclick="setFav()" type="button" value="Load favorite">
 
PREVIOUS NEXT
Tagged: #Save #multiple #radios #checked #LocalStorage
ADD COMMENT
Topic
Name
2+2 =