I have this code:
Search: <input type="text" id="fname" onkeyup="myfunction()">
<a id="sear" href="" target="_blank">Search</a>
<script>
function myFunction() {
var x = document.getElementById("fname").value;
var url = "https://www.google.co.in/search?q=all+"+x+"&biw=1366&bih=643&source=lnms&tbm=isch";
document.getElementById("sear").href=url;
}
</script>
I have implemented this in WordPress and the link is now pointing to the same page rather than opening the google search page.