Sandeep Rawat Sandeep Rawat - 8 months ago 37
Javascript Question

On form submit using <span> button redirect to new site

I need to submit the below form and redirect the page to another site to display the search result as per the input searchString.

<a href="#" class="button search">
<span class="spanclass"></span>
<input class="expand" name="searchString" type="text">
<span id="searchButton" class="search icon-small open-btn"></span>

I am wondering how can I process it either using javascript, jquery or ajax. Please provide your valuable inputs. As I have the submit button as span, I am not sure how I can use it to submit the form. Thanks folks in advance for the valuable information.


inline js solution

<span id="searchButton" class="search icon-small open-btn" onclick="document.forms['form-name'].submit();"></span>

but since you also included jquery tag for your question :)