我可以在沒有jQuery的情況下將這段代碼用于(bootstrap 5)嗎?
<script type="text/javascript">
$( document ).ready(function() {
setInterval(function() {
var attend = jQuery('#pills-profile').hasClass('active')。
if(ex attend == true){
jQuery('#id2').show()。
jQuery('#id1').hide()。
}else{
jQuery('#id2').hide()。
jQuery('#id1').show()。
}
}, 1000)
});
uj5u.com熱心網友回復:
像這樣的事情
span class="hljs-variable language_">document. addEventListener("DOMContentLoaded", function () {
const first = document.getElementById("id1") 。
const second = document.getElementById("id2") 。
const attend = document.getElementById("pills-profile") 。
setInterval(function () {
if (attend.classList.contains("active"/span>)) {
second.style.display = "block";
first.style.display = "none";
} else {
second.style.display = "none";
first.style.display = "block";
}
}, 1000)。)
});
轉載請註明出處,本文鏈接:https://www.uj5u.com/qukuanlian/333302.html
標籤:
上一篇:需要函式來增加日期的值
