[Resolved] Display element only while url contain keywords

Home Forums Support [Resolved] Display element only while url contain keywords

Home Forums Support Display element only while url contain keywords

Viewing 3 posts - 1 through 3 (of 3 total)
  • Author
    Posts
  • #1529409
    Marcin

    Hello, I have a problem with my page. I’m using 3-rd party searching tool, so I have only one page in my shop which i like. However while someone search for category I want to display more information about it. My searching tool adds slug to URL for example “_cat_category1” and it is the only diffrent between categories.
    I want to add div with difrent conntent depending of this slug. I’ve tried using JS like that:

    Holder
    <script>
    	displayContent();
    	function displayContent(){
    		var d = document.getElementById("catContent");	
    		if(window.location.href.include('_cat_category1'))
    		d.innerHTML = window.location.href;
    	}
    </script>

    But it does not work. Could You help me?

    #1529417
    Marcin

    Sorry for disturbing, changing include to match works

    #1529613
    David
    Staff
    Customer Support

    Hi there,

    glad to hear you found a solution!

Viewing 3 posts - 1 through 3 (of 3 total)
  • You must be logged in to reply to this topic.