IfnotFr / PopConfirm

A simple action confirmation plugin for jQuery based on Twitter Bootstrap Popover

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Not working with on("click", ... ) handlers

gerwinbrunner opened this issue · comments

Hi,

it seems that the plugin is not working when I have the event handlers registered like this:

  $(document).on "click", ".do-confirm", ->
    console.log "hey"
    return

  $(".do-confirm").click ->
    console.log "hoe"
    return

  $(".do-confirm").popConfirm()

The "hoe" gets printed, but the "hey" does not.
Is there a reason why this is this way?

Cheers,
Gerwin

P.S.: I'd lover to use this plugin with meteorJS and they register the events like mentioned in the first example.

Any idea?

Hello,

Thanks for using the plugin :)

It looks that $('...').on("click") is not returned while checking events with jQuery._data(this, "events").click.length, here : https://github.com/Ifnot/PopConfirm/blob/master/jquery.popconfirm.js#L61

I have no time to investigate atm, maybe someone ? :)

Hi @gerwinbrunner

I had the same problem so created the pull request below. It's not really a solution but it's a workaround that might get your further.

#33