$(this).text()==="显示简介" 显示的no 而不是yes

【字号: 日期:2022-06-04浏览:69作者:雯心

问题描述

<script src="https://cdn.bootcss.com/jquery/3.2.1/jquery.min.js"></script>

<script>

$(function(){

$("#btn").click(function(ev){

if ($(this).text()==="显示简介") {

alert('yes');

}else {

alert('no');

}

});

})

</script>

</head>

<body>

<button id="btn">

显示简介

</button>

<div id="ppt" style="display: none;">11111</div>

</body>

问题解答

回答1:

button里面能分行?

“===” 和 “==”是有很大区别的

相关文章: