1. 程式人生 > >js判斷 不能重復輸入相同的內容

js判斷 不能重復輸入相同的內容

document for put blog on() 判斷 gpo 輸入 內容


$(document).on(‘input propertychange‘,‘.level‘,function(){

var val = $(this).val();
var ind = $(this).index(‘.level‘);
var len = $(‘.level‘).length;
for(var i =1 ; i<len; i++){

if(ind != i){

if(val == $(‘.level‘).eq(i).val() ){

that.errorMsg(‘不能重復輸入‘);
$(this).val(‘‘);

}

}

};

});

js判斷 不能重復輸入相同的內容