indirect / jquery-rails

A gem to automate using jQuery with Rails 3
MIT License
465 stars 36 forks source link

JS Error: Uncaught TypeError: Object #<an HTMLDocument> has no method 'on' #44

Closed GSto closed 13 years ago

GSto commented 13 years ago

get this error from rails.js after installing jquery-rails.

htp commented 13 years ago

I'm using a fresh Rails 3.0.4 app with jquery-rails 0.2.7, and I can't reproduce this problem.

Does the problem still exist if you use rails.js from https://github.com/rails/jquery-ujs/blob/master/src/rails.js ?

pwgustafson commented 13 years ago

I am also having this issues,

I am using rails 3.0.5 - any idea what is causing this issue?

purp commented 12 years ago

Likewise, using Rails 3.0.9 ... would be nice to have a pointer to what actually breaks. Here's the JS that's being complained about:


  document.on("click", "*[data-confirm]", function(event, element) {
    var message = element.readAttribute('data-confirm');
    if (!confirm(message)) event.stop();
  });

  document.on("click", "a[data-remote]", function(event, element) {
    if (event.stopped) return;
    handleRemote(element);
    event.stop();
  });

  document.on("click", "a[data-method]", function(event, element) {
    if (event.stopped) return;
    handleMethod(element);
    event.stop();
  });