var test = "Example";
var another = "Example";
<div id="whatever">
Blah
</div>
$('#whatever').hide()
如果test
不another
匹配,我该如何申请$('#whatever').css('color','red')
?
var test = "Example";
var another = "Example";
<div id="whatever">
Blah
</div>
$('#whatever').hide()
如果test
不another
匹配,我该如何申请$('#whatever').css('color','red')
?
简单的:
<script type="text/javascript">
if(test === another){
$('#whatever').hide();
}else{
$('#whatever').css('color','red');
}
</script>
使用if 语句:
if(test == another)
$('#whatever').hide();
else
$('#whatever').css('color','red');