我有這個工作腳本:<script>jQuery( document ).ready(function() { console.log( "ready!" );var hideUrl=['https://www.gustotosto.it/shop/boni/','https://www.gustotosto.it/shop/agropic/',];if(hideUrl.indexOf(window.location.href)>=0){ jQuery('.title-shop').hide();}});</script>現在我想修改它,因為它只是隱藏了 var 中列出的 url 的“.title-shop”;如果 url 包含 var hideUrl,我想擴展它并隱藏“.title-shop”,包括子頁面。我這樣修改了它,但它不起作用。怎么了?有人可以幫助我嗎?<script>jQuery( document ).ready(function() { console.log( "ready!" );var hideUrl=['https://www.gustotosto.it/shop/boni/','https://www.gustotosto.it/shop/agropic/',];if (window.location.href.indexOf("hideUrl") > -1){ jQuery('.title-shop').hide();}});</script>
修改和擴展一個有效的 jquery 腳本
月關寶盒
2023-05-19 15:06:31