how to retain selected checkbox for selectAll option

I have a <select> element with multiple options.I am using multipleSelect jquery method to implement selectAll.

$("select#someid").multipleSelect({width: '100%', filter: true, selectAll: true})

to retain the selected options after form submission I am doing this

$ ->
   someValue = localStorage.getItem('someid')
   if someValue != null
     $('select[name=somename]').val someValue
   $('select[name=city]').on 'change', ->
     localStorage.setItem 'someid', $(this).val()
     return
   return

this approach is working to some extent. when I select some options and submit the value,the values are retained after the submission. But for some reason it is not working for selectAll.when I check the selectall (all options checked including the selectAll) after the form submission, all the options are unchecked or option values are not retained.I am very new to frontend. Any help would be appreciated.

This topic was automatically closed 182 days after the last reply. New replies are no longer allowed.