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

  • SEARCH
  • Home
  • 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 7083749
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 28, 20262026-05-28T07:12:59+00:00 2026-05-28T07:12:59+00:00

I recently had a little problem using a jquery plugin with coffeescript (within the

  • 0

I recently had a little problem using a jquery plugin with coffeescript (within the Rails 3.1 asset pipeline, if that helps). I looked around a bit, but couldn’t really figure out, why it behaves this way.

So, why does this not work (talking about the corner call on $(‘.overlaybox’)):

$ ->
  $('#slides').sortable
    axis: 'y'
    update: ->
      $.post($(this).data('update-url'), $(this).sortable('serialize'))

  $(".overlaybox").corner()

but this does work (took the corners call out of the jQuery ready thing):

$ ->
  $('#slides').sortable
    axis: 'y'
    update: ->
      $.post($(this).data('update-url'), $(this).sortable('serialize'))

$(".overlaybox").corner()

I keep getting a

TypeError: 'undefined' is not a function (evaluating '$(".overlaybox").corner()')

if I leave it in there.. Maybe I’m just blind right now, but I can’t figure out why I can’t leave it in there. Even the compiled code looks legit (at least to me it does ;-)).

Thanks so much for your time and clarifying.

Marcel

UPDATE
Here’s some relative code:

# app/assets/javascripts/application.js
//= require jquery
//= require jquery-ui
//= require jquery_ujs
//= require jquery.Jcrop
//= require jquery.corner
//= require jqtextile
//= require_tree .

# app/assets/javascripts/slides.js
$ ->
  $(".overlaybox").draggable 
    containment: 'parent',
    drag: -> 
        offset = $(this).position()
        xPos = offset.left
        yPos = offset.top
        $('#slide_xpos').val(xPos)
        $('#slide_ypos').val(yPos)


  $('#slides').sortable
        axis: 'y'
    update: ->
        $.post($(this).data('update-url'), $(this).sortable('serialize'))

  $(".overlaybox").corner()

And then the view (app/views/slides/_form.html). The funny thing is, that corners works, as soon as I take it out of the jquery document ready event.
I think I’m missing something substantial regarding the scope of all of this:
When I do a console.log inside the $ -> on corner, I get an undefined. But when I do the same outside of the $ -> (actually below), I get the proper output AND it gets fired even before the jquery (of course). But why is it not available in the jQuery block? Is it a scope thing with coffeescript I’m missing? (I’m having the same problem with a different plugin right now)

Thanks so much again!

here’s also the compiled javascript code, if that helps

$(function() {
    console.log($('.overlaybox'));
    console.log($('.overlaybox').corner);
    $(".overlaybox").draggable({
      containment: 'parent',
      drag: function() {
        var offset, xPos, yPos;
        offset = $(this).position();
        xPos = offset.left;
        yPos = offset.top;
        $('#slide_xpos').val(xPos);
        return $('#slide_ypos').val(yPos);
      }
    });
    $('#slides').sortable({
      axis: 'y',
      update: function() {
        return $.post($(this).data('update-url'), $(this).sortable('serialize'));
      }
    });
    return $(".overlaybox").corner();
  });
  • 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-05-28T07:13:00+00:00Added an answer on May 28, 2026 at 7:13 am

    Well, the problem was, that I had some precompiled assets (older stuff) in my rails public folder, that was kinda messing with my jQuery calls. Cleared it, learned my lessen, everything works now as expected.

    Anyway, thanks so much guys, I really appreciate your help!

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I recently had an idea to create my own String class to make using
I recently had the MacBook I'm using to develop an app (for work) rebuilt.
I recently had to run a job that required all the mappers to finish
Recently, I like using CSS-Table Layouts more and more. When I had another issue
I had an issue recently (see my last question) that led me to take
Summary I recently had a conversation with the creator of a framework that one
We recently had a problem where, after a series of commits had occurred, a
I recently had a discussion with a colleague about serialization of byte data over
I recently had the task of adding a barcode onto a SSRS report without
I recently had to change my active directory account password. Ever since then I

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.