在下面的代码中,当我单击超链接时,也没有在文本框为空的情况下看到警报。我究竟做错了什么?
<a href="#" class="but" id="next_btn">Next</a>
<input name="text" class="but" id="newcampaign" />
CM.Views.newCampaign = Backbone.View.extend({
validate : function () {
if ($("#newcampaign").val() == "") {
alert("Enter campaing name");
}
},
initialize : function() {
_self=this
this.campaign = new Campaign();
this.campaign.url='js/editdata.json';
},
events:{
'onclick #next_btn': 'submit_form'
},
submit_form : function(){
alert("here");
},
});