2014-10-23 8 views
0
if ($('#plotOption').val() == "average") { 
    alert('av'); 
} 

$('#plotOption').select2({ 
    createSearchChoice: function() { 
     return null; 
    }, 
    tags: ["average", "Maximum", "Minimum"] 
}); 

3 개 또는 모두를 선택하고 하나가 평균 인 경우 경고를 표시하지 않습니다. .val()는 예를 들어 있습니다. 평균, 최대, 최소Select2 태그에서 값 가져 오기

답변

2

사용 .indexOf() :

if($('#plotOption').val().indexOf("average") > -1) { ..... 
관련 문제