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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 30, 20262026-05-30T14:09:46+00:00 2026-05-30T14:09:46+00:00

I guess this is really simple, but I can’t get it to work. I

  • 0

I guess this is really simple, but I can’t get it to work. I have a script in my help.js in app/assets/javascript.

This is loaded and if I add an alert() it is run, but when I try to call the javascript (jquery click()) nothing happens. If I have the javascript-code in the page it works if at the bottom of the page.

I guess the includes from the assets are put at the start of the page, and then my script won’t work. So…

  1. Am I completely worthless at writing javascripts?
  2. Should the javascript be placed at the end, and how would that be done when requiring it from assets without moving the complete javascript_include_tag? (I guess I could exclude it from applications and load it separately, but it feels wrong).
  3. It feels very strange that this shouldn’t work, so where did I go wrong?

help.js

$('.clickme').click(function() {
  $('#working').show();
  var htmlStr = this.getAttribute('data-message');
  $('#helper_box').html(htmlStr);
  $('#helper_box').toggle('slow', function() {
    // Animation complete.
    $('#working').hide();
  });
});

index.html.erb

<div class="clickme" data-message="Something...">
  <%= image_tag("question_mark.png", :alt => "helper") %><br>
</div>
  • 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-30T14:09:48+00:00Added an answer on May 30, 2026 at 2:09 pm

    Events in jQuery should be added after the document is completely loaded. Have you tried using

    $(document).ready(function() {
      $('.clickme').click(function() {
        $('#working').show();
        var htmlStr = this.getAttribute('data-message');
        $('#helper_box').html(htmlStr);
        $('#helper_box').toggle('slow', function() {
         // Animation complete.
         $('#working').hide();
        });
      });
    });
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

i guess this is a really simple problem, but i just can't get it
I guess this is simple, but i couldnot figure it out. i have a
I guess this is kind of an odd question but I have tried setting
I guess this is fairly simple for you but i cant wrap my head
It's probably something really simple, but I can't find it in the docs and
This question can be very simple but could not find the answer; I receive
ok, this seems like it should be really simple but Im a bit confused:
I guess this is a really simple question and, probably, one that has been
This is probably a really simple question but one I've never quite worked out
This is really simple. I have a TableLayoutPanel that is populated with controls (just

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.