ehynds / jquery-ui-multiselect-widget

jQuery UI MultiSelect widget

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

selected property not being honoured

vincentwansink opened this issue · comments

The problem I'm having is that I want all the options in my select to be selected on page load, and according to the documentation I should be able to do this by simply adding "selected='selected'" to each option, but it's not working for me. It's only selecting the last item in the list.

This is my select

<select id=fullpart name=fullpart style='width:450px'>
  <option value='F' selected='selected'>Full Time</option>
  <option value='P' selected='selected'>Part Time</option>
  <option value='D' selected='selected'>Drop In</option>
</select>

And here's my javascript

    $('#fullpart').multiselect({
      noneSelectedText: 'Any Type',
      selectedList: 3,
      header: false,
      height: 'auto',
      classes: 'standardinput',
      minWidth: 150,
      click: function(event,ui){toggleSelectedType(ui)}
    });

I'm using version 1.4 of the multiselect.js, and I tried upgrading to the latest version but it didn't solve my problem, only confused my CSS so I'd rather stick with 1.4 and make it work.

If you need to see the full script I've zipped it up and attached it here:
test.zip

Never mind. I didn't have "multiple=multiple" in my select.

<select id=fullpart name=fullpart multiple=multiple style='width:450px'>
  <option value='F' selected='selected'>Full Time</option>
  <option value='P' selected='selected'>Part Time</option>
  <option value='D' selected='selected'>Drop In</option>
</select>

Problem solved.