I would like to hide a div on more than one but not all pages of a site. The following solution hides it on one page but how can I add two or 3 particular pages?
Original answer here: Hide div based on url
<script language="text/javascript">
$(function(){
if (window.location.pathname == "mywebsite/Videos.html") {
$('#navleft').hide();
} else {
$('#navleft').show();
}
});
</script>
just give an or condition
$(function(){
if (window.location.pathname == "mywebsite/Videos.html"||window.location.pathname == "url2.html"||window.location.pathname == "url3.html") {
$('#navleft').hide();
} else {
$('#navleft').show();
}
});
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With