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 3345074
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 18, 20262026-05-18T01:08:36+00:00 2026-05-18T01:08:36+00:00

I am working on a rails app, where I am using jQuery and the

  • 0

I am working on a rails app, where I am using jQuery and the Facebox Lightbox for popup forms. I want to use some jQuery validation on the form. When I try to implement this, I run into some weird results.

If i put the javascript directly into the view I am loading in the popup, the javsacript works just fine.

Example: app/views/item/view.html.erb

...

<script type="text/javascript">
    $(document).ready(function() {
        ...
    });
</script>

However, if I abstract it one step and put the javascript into the layout I am using for the popup, it fails.

Example: app/views/layouts/popup.html.erb

<script type="text/javascript">
    $(document).ready(function() {
        ...
    });
</script>

<div id="popup">
    <%= yield %>
</div>

It also fails if I pull the script from being directly coded into the view into a seperate javascript file, for example if i put the same script into ../public/javascripts/popup.js

then in my view i do:

<%= javascript_include_tag 'popup' %>

It fails here to.

You’d think that it wouldn’t make any difference which file it’s in. It should get loaded the same way.

Any idea on why this is happening?

  • 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-18T01:08:37+00:00Added an answer on May 18, 2026 at 1:08 am

    I think in your document.ready code you’re doing something like

    $(".supercool")..bind('click', function() {
      somethingAwesome();
    });
    

    So that will attach to all classes with supercool class that exist on load. What you want to do is use the live

    $('.supercool').live('click', function() {
      // Live handler called.
    });
    

    That’s just a guess though — I think that’s what’s going on — need to see more javascript if it’s not that.

    http://api.jquery.com/live/

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

Sidebar

Related Questions

I'm working on a Rails app that sends data through a form. I want
I have jquery working on my Rails app using the gem 'jquery-rails' . I
I'm kinda new to using Rails, and an app I am working on is
I'm working on a Rails app and am looking to include some functionality from
I am working with a Rails 3RC app and using Phusion Passenger for the
I am using the JQuery Autocomplete UI with my rails app and it is
I'm using Rails with the JQuery plugin, and have some really complicated validations for
I'm working on a Rails app using CanCan for RBAC and I only have
I'm using attr_encrypted in my rails app and it is not working as expected.
in my rails 3 app I use devise. For the password reset form 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.