Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8439407
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 10, 20262026-06-10T08:00:10+00:00 2026-06-10T08:00:10+00:00

I am getting an error in Firebug console: TypeError: $.on is not a function

  • 0

I am getting an error in Firebug console:

TypeError: $.on is not a function
$.on('ajax:success', 'a[data-remote]', function(xhr, data, status) {

which is line 8 of my modal.js file – see below. I am using code from gist.github.com/1456815.

I can find the relevant jQuery v1.7.2 minified code in application.js:

f.fn.extend({on:function(a,c,d,e,g){var h,i;if(typeof a=="object")

jQuery and then my modal.js code is being loaded by the asset pipeline, so I don’t understand the error, which shows in Firebug when my index page is loaded i.e. before I click on the link.

Versions: Ruby 1.9.3, gem 1.8.24, Rails 3.2.1, Rake 0.9.2.2

My application.js source:

//= require jquery
//= require jquery-ui
//= require jquery.dataTables
//= require TableTools
//= require ZeroClipboard
//= require datatable_highways
//= require datatable_localities
//= require datatable_neighbours
//= require_tree .
//= require modals

As per RailCasts #205 I have downloaded rail.js into /public/javascripts and renamed to jquery.rails.js. Frankly I don’t understand this and it is not explicitly included in the asset pipeline. (There seems to be confusion about what to do with rails.js in the forums).

jquery.js is in /vendor/assets/javascripts.

Modal.js.coffee:

# This file should be "required" into your `application.js` via the Asset Pipeline.

$ ->
  $modal = $('#modal')
  $modal_close = $modal.find('.close')
  $modal_container = $('#modal-container')

  # Handle modal links with the data-remote attribute
  $.on 'ajax:success', 'a[data-remote]', (xhr, data, status) ->
   $modal
    .html(data)
    .prepend($modal_close)
    .css('top', $(window).scrollTop() + 40)
    .show()
   $modal_container.show();

  $.on 'click', '#modal .close', ->
    $modal_container.hide()
    $modal.hide()
    false

Thanks
John

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-10T08:00:11+00:00Added an answer on June 10, 2026 at 8:00 am

    Do something like this instead:

    $('#modal .close').on 'click', ->
        # code
    

    Or, even better, to use your code:

    $modal_close.on 'click', ->
        # code
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

i m getting error in firebug console uncaught exception: [Exception... 'Invalid save data.' when
I'm getting an error in firebug: NetworkError: 404 Not Found - (removed)/style.css What does
I'm getting syntax error in firebug here is the code : $('#moderator-attention').live('toogle', function(){ function
I am getting the error missing ) after argument list in my Firebug console.
Here's my code - I am getting an error in my firebug console that
I am getting this error in the firebug console and can't work out why.
Getting error while inserting values into database (SQL Server 2008) Implicit conversion from data
to is not defined [Break on this error] setTimeout('updateChat(from, to)', 1); I'm getting this
My jQuery code is not working and in Firebug console it says: jQuery is
I have been trying to remove this Firebug Console Error from last few hours.

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.