4

I am creating a sample Modular backbone application. I am loading different view with the help of router.In one of my view I have a button which has a click event function defined. The problem is When i click this button the click event function is getting called twice.

Any help Would be appreciated!!!!!

below is my code

events: {
    'click #hitMe': 'DisplayStudentColl'
},
DisplayStudentColl: function(e) {
   var data = { };
}
mu is too short
  • 426,620
  • 70
  • 833
  • 800
Priyank Jain
  • 97
  • 2
  • 9

2 Answers2

0

There's not a lot of code to work with but for debugging this, you could try unbinding the click event immediately before setting up the click event. Failing that there could be an element further up the DOM with the same click event so try isolating the elements you're working with.

Andy Gee
  • 3,149
  • 2
  • 29
  • 44
0

Your view is certainly not clean

see this: Backbone.js : repopulate or recreate the view?

and http://lostechies.com/derickbailey/2011/09/15/zombies-run-managing-page-transitions-in-backbone-apps/

Community
  • 1
  • 1
Justin wong
  • 638
  • 6
  • 15