I have a form in a popup that displays a page with a search field in it.
But when I click on return on my computer to submit the form it is not submitting it or not finding it!?
<form action="#" id="tabkategoriersok" class="searchbar" >
<div class="searchbar-inner">
<div class="searchbar-input-wrap">
<input type="search" name="tabsoktexten" placeholder="Search..." />
<i class="searchbar-icon"></i> <span class="input-clear-button"></span></div>
<span class="thesubmitbutton">SEARCH</span>
</div>
</form>
and in my .js file I have this.
$$('#tabkategoriersok').submit(function( event ) {
app.dialog.alert("submit the form")//it is not even showing the alert!
app.popup.close();
event.preventDefault();
});
But if I click on the button it is finding that event
$$(document).on("click",".thesubmitbutton", function(event){
app.dialog.alert("click button to submit the form")//this is working!!
app.popup.close();
});
Why isn´t it finding the submit event? What I´m I missing?
All it does is reloading the hole site!
Thanks.
Ok so I got this now and it is running the event and it loads the “products” page as it should.
-
But it is still submitting the form, SO, how do I prevent it from submitting the form and just load my page?
-
And this is only submitting the form if I have a written value, but how can I submit it without having to write a value? Just loading my “products” page when hitting enter?
app.on(‘formAjaxBeforeSend’, function (e, data, xhr) {
//e.preventDefault();
console.log(“before submit”)
mainView.router.navigate("/products/", {ignoreCache: true,force:true});
});