I wrote the following script. It listens on a Search Text Input Field, and takes the value and forwards to my Search Page (at /Home/Search).
<script type="text/javascript">
$("#search").on('keydown', function (e) {
var searchVal = $("#search").val();
if (e.keyCode == 13) {
var url = '/Home/Search?' + searchVal;
window.location.href = url;
}
});
</script>
For some reason, it is not doing anything. My current page location never changes, and a "?" just gets appended to the end of my current URL.
Was wondering if anyone has any ideas. Thanks!!!
EDIT Here it is in action: https://municipalagenda.com/
The Search Bar across the top + hitting enter in the field triggers the aforementioned JavaScript function.