javascript - How to make click event.target live? -
i'm developing pop-up button, designed code
$(event.target).click(function() { window.open("/widget/dialog", "", ""); });
however, doesn't work when click first time. works when click second time. how can solve problem?
however, doesn't work when click first time.
that's because first time handler executed binds (not executes!) another event handler calls window.open("/widget/dialog", "", "")
.
now have two event handlers bound element , both executed when click second time. means yet another event handler bound, after second click, three event handlers bound element.
if want work "the first time", want in "outer" event handler. not bind event handler in handler. forget $(event.target).click(...)
.
template.button.events({ 'click button': function(event, template) { window.open("/widget/dialog", ""); }, });
Comments
Post a Comment