javascript - Backbone.js events not working -


when click continue button, text box should shown in div, it's not happening. here code.

html file :

    <button class="btn btn-success pull-right" id="3continue"                                         type="button"> 

my javascript file :

    events:{           'click button#3continue': 'displaycoupon'            },     initialize: function(){             var self=this;            _.bindall(this,'render','addproductdetails','displaycoupon');               this.collection = new list();             this.addproductdetails();         },     displaycoupon: function(){       //e.preventdefault();       console.log("in displaycoupon");       $('#couponcheck').empty();       $('#couponcheck').append('<div class="col-xs-8"><input  type="text" class="form-control" id="entercoupon"></div>');       $('#couponcheck').append('<div class="col-xs-8"><button type="button" class="btn btn-success btn-sm" id="couponbutton">apply</button></div>');   }, 

please try this:

html:

 <button class="btn btn-success pull-right" id="clickme"                                             type="button"> 

javascript:

 events:{           'click #clickme': 'displaycoupon'            },     initialize: function(){             var self=this;            _.bindall(this,'render','addproductdetails','displaycoupon');               this.collection = new list();             this.addproductdetails();         },     displaycoupon: function(){       //e.preventdefault();       console.log("in displaycoupon");       $('#couponcheck').empty();       $('#couponcheck').append('<div class="col-xs-8"><input          type="text" class="form-control" id="entercoupon"></div>');       $('#couponcheck').append('<div class="col-xs-8"><button type="button" class="btn btn-success btn-sm" id="couponbutton">apply</button></div>');   }, 

in code have written

events:{        'click button#3continue': 'displaycoupon'       }, 

try replacing above code code given below:

 events:{       'click #3continue': 'displaycoupon'        }, 

Comments

Popular posts from this blog

How to connect android app to App engine -

gcc - MinGW's ld cannot perform PE operations on non PE output file -

php - display validation error message next to the textbox in codeigniter -