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>

关于javascript - 如果变量与另一个变量匹配,我们在Stack Overflow上找到一个类似的问题:https://stackoverflow.com/questions/10202426/

10-13 05:15