Sunday, 15 March 2015

jquery - Select2 Getting value from tags -



jquery - Select2 Getting value from tags -

if ($('#plotoption').val() == "average") { alert('av'); } $('#plotoption').select2({ createsearchchoice: function() { homecoming null; }, tags: ["average", "maximum", "minimum"] });

when select 3 or 2 , 1 of thouse average won't show alert. .val() example. average,maximum,minimum

use .indexof():

if( $('#plotoption').val().indexof("average") > -1 ) { .....

jquery jquery-select2

No comments:

Post a Comment