• LovellyStRose

    (@lovellystrose)


    When a user selects the search box in the header of my website, the page begins to reload. It seems to be an issue across browsers, and I can’t seem to find out where in my code the issue is.

    The code for the header section:

    <div id='topNavBar' onclick="location.href='<?php echo home_url(); ?>' ">
    	<form method="get" id="searchform" action="<?php bloginfo('home'); ?>/">
    <div><input type="text" size="18" value="<?php echo wp_specialchars($s, 1); ?>" name="s" id="s" />
    <input type="submit" id="searchsubmit" value="Search" class="btn" />
    </div>
    </form>
    	<div id='title'  title="The Saint Rose Chronicle" onclick="location.href='<?php echo home_url(); ?>' ">
    	 </div>
    </div>

    …and the code for the search bar:

    <form role="search" method="get" class="search-form" action="<?php echo home_url( '/' ); ?>">
    	<label>
    		<span class="screen-reader-text">Search for:</span>
    		<input type="search" class="search-field" placeholder="Search …" value="" name="s" title="Search for:" />
    	</label>
    	<input type="submit" class="search-submit" value="Search" />
    </form>

    The website in question is: http://www.strosechronicle.com

Viewing 1 replies (of 1 total)
  • Dandy Plow

    (@dandy-plow)

    Your problem is here:

    <div id="topNavBar" onclick="location.href='http://strosechronicle.com/wordpress' ">

    Your search field is inside that div which is set to refresh/redirect when it is clicked. So when you click on the search field, it’s getting triggered. So you need to get the search bar code out of that div, or remove the onclick function, or something else along those lines.

Viewing 1 replies (of 1 total)
  • The topic ‘Website Reloads when Search Box is Selected’ is closed to new replies.