jQuery .on() not firing in real-time view. #148

phuu opened this Issue Apr 18, 2012 · 3 comments


None yet

2 participants

Dave, The Bin Bot member

jQuery .on() events will not fire in real time view, but will in render view.

Include jQuery 1.7 or later. Example code fails:

$(function () {
  $('body').on('click', function (e) {

-- RS edit --

Example link: http://jsbin.com/ufelah/7

Dave, The Bin Bot member

Issue with ready event firing before the iframe is done. Already handles $(document).ready - probably need to add the same hack in place.

Dave, The Bin Bot member

Okay, so the live render never shows you alerts, prompts or confirm boxes - because it re-renders as you type, an alert box firing all the time would interrupt the development flow. The "render" button does include alerts because you're triggering it.

So in fact it's on purpose that the alert doesn't work - so technically a feature!

However, it does give me an idea - I could nuke all alerts loading and then re-introduce the alert method once render is complete so that if you interact with the preview, it'll still fire alerts.

I'm not 100% about this, but I'll try it out in the jsbin beta: http://jsbin.com/3/ - it'll be live in a few minutes....

@remy remy closed this Apr 18, 2012
Dave, The Bin Bot member

Working example of where the alerts are removed during load, but re-instantiated once all user code is complete: http://jsbin.com/3/ufelah/10/edit?html,javascript,live

@remy remy added a commit that referenced this issue Jul 20, 2012
@remy remy Remove alerts only during load - put them back in to allow user to in…
…teract and get alerts. Fixes #148
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment