Setting an option value in a jQuery Multiselect dropdown

Asked

Viewed 405 times

1

I’m using the library Bootstrap Multiselect:

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

As the above code I want to select a certain option of select. Since it doesn’t work. If I copy the code and run on the console it works.

1 answer

1


Seeing the plugin documentation, it already provides you with one method select to help you in this task:

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

Follows the jsfiddle I used for testing :)

Browser other questions tagged

You are not signed in. Login or sign up in order to post.