Check out the search functionality below:
<form class="form-wrapper cf">
<input type="text" placeholder="Enter keywords..">
<button onclick="search_click();">Search</button>
</form>
The function search_click()
is implemented like this:
function search_click(){
window.location.replace("http://stackoverflow.com");
}
Although when I click on the button, the current page reloads and a question mark is added to the URL if it wasn't already there. I also tried using window.location.href
but had no luck. Strangely, if I replace that line with alert('test');
, it does show a pop-up, proving that the function is being executed. Can anyone help me identify the issue in my code? Or could it perhaps be a problem with Django?