当前位置: 动力学知识库 > 问答 > 编程问答 >

addclass - jQuery Can't Figure out Remove Class - Add Class

问题描述:

Hoping someone can see the error(s) in my code.

Scenario: Check database to see if sname exists. If it does, return "Screen Name is Already Taken" else return "Screen Name is Available".

The result is returning but the removeClass/addClass is not working as desired.

function ChkScrNmAvblty(sname) {

$.ajax({

url: 'includes/checkScreenName.asp',

data: 'sname=' + sname,

success: function(data) {

$("#scaResult").html(data);

if (data == "Screen Name is Already Taken") {

$('#scaResult').removeClass('grn').addClass('red');

}

}

});

}

分享给朋友:
您可能感兴趣的文章:
随机阅读: