Friday, 15 May 2015

How do you change the selected option of a jquery selectric element using javascript? -



How do you change the selected option of a jquery selectric element using javascript? -

i can alter original select's selected alternative doing like-

$('#myselectlist option:first').prop('selected', true)

but doesn't update selectric display of select.

according this pull request, can "refresh" plugin:

$('#myselectlist').prop('selectedindex', 0).selectric('refresh');

from documentation:

$('select').selectric('refresh'); // reconstruct instance of plugin

javascript jquery jquery-plugins

No comments:

Post a Comment