I am trying out different functionalities using backbone and i came accross a strange one. I am trying to submit a form through backbone. I had done this previously and i cannot find whats wrong with what i am doing.
The code is as follows :
HTML Part
<div clas="loginpage"></div>
<form class="login-user-form">
<input type="text" name="name" id="name" placeholder="Enter Name"><br><br>
<button type="submit" class="btn">Create</button>
</form>
jQuery Part
var UserLogin = Backbone.View.extend({
el:'.loginpage',
initialize:function(){
console.log("Login View Initialized");
},
events:{
'submit .btn' : 'loginuser'
},
loginuser:function(){
console.log("Login Clicked.");
return false;
}
});
var userlogin = new UserLogin();
I get Login View Initialized message in console. But i cannot get the loginuser function to work. The page submits through its default submit functionality.
What am i doing wrong?