Configuring an option value in a jQuery Multiselect dropdown

1

I'm using the Bootstrap Multiselect library:

$("select#final option[value='" + data[0].final + "']").prop('selected', true);
$('select#final').multiselect("refresh");

As the code above I want to select a particular option of select . Being that does not work. If I copy the code and run the console it works.

    
asked by anonymous 22.10.2015 / 05:51

1 answer

1

Seeing the plugin's documentation, it already provides you with a method select to help you with this task:

$('seuSelect').multiselect('select', ['1', '2', '4']);

Here's the jsfiddle that I used for testing:)

    
22.10.2015 / 12:10