PopConfirm icon indicating copy to clipboard operation
PopConfirm copied to clipboard

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

Open gerwinbrunner opened this issue 10 years ago • 3 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.

gerwinbrunner avatar Nov 13 '14 22:11 gerwinbrunner

Any idea?

gerwinbrunner avatar Nov 18 '14 18:11 gerwinbrunner

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 ? :)

IfnotFr avatar Nov 21 '14 10:11 IfnotFr

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.

https://github.com/Ifnot/PopConfirm/pull/33

markwylde avatar Jul 04 '16 14:07 markwylde