Dynamic Visibility Based on Page Path in Elementor

Facebook
Twitter
Reddit
WhatsApp

jQuery - Hide element

				
					<script>window.addEventListener('DOMContentLoaded', function() {
    const $ = jQuery;
    $(document).ready(function() {
        const pagePath = window.location.pathname;
        const footerCTA = $('.footerCTA') // class name
        console.log(pagePath)
        
        if(pagePath === ""){ // Page path
            footerCTA.hide()
        }
    })
});</script>
				
			

jQuery - Show element

				
					<style>
    .footerCTA{
    display: none
}
</style>
<script>window.addEventListener('DOMContentLoaded', function() {
    const $ = jQuery;
    $(document).ready(function() {
        const pagePath = window.location.pathname;
        const footerCTA = $('.footerCTA') // class name
        
        if(pagePath === ""){ // Page path
            footerCTA.show()
        }
    })
});</script>
				
			
Subscribe
Notify of
0 Comments
Inline Feedbacks
View all comments

More to explorer

0
Would love your thoughts, please comment.x
()
x

45 Minute Wordpress Support

Get your Wordpress questions answered and your Wordpress issues resolved.