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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 9, 20262026-06-09T20:56:10+00:00 2026-06-09T20:56:10+00:00

I am using Drupal CMS. In Drupal there is a messages DIV that has

  • 0

I am using Drupal CMS. In Drupal there is a messages DIV that has a class of .message
When an error appears, the class "error" is added to the message DIV.

On my page, I have a DIV that has a class of "instruction"
I want this DIV to be hidden and only appear when the error class is visible.

Here is my code:

 (function ($) {
    $(document).ready(function () {
        $(".instruction").hide;
    });

    if ($('.messages').hasClass('error')) {
    $('.instruction').show;
    }

})(jQuery);

However, it doesn’t seem to work. How can I make it work? Thanks for any help!

  • 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-09T20:56:11+00:00Added an answer on June 9, 2026 at 8:56 pm

    It’s a function call, you’ll need to add () like this:

    $.ready(function() {
        $(".instruction").hide();
    
        if ($(".messages").hasClass("error")) {
            $(".instruction").show();
        }
    
    });
    

    Here’s the Fiddle (Remove the “error” from the HTML to see it work).

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

Sidebar

Related Questions

I have to crate a simple CMS using drupal, It has 4 pages and
I'm using Drupal and I notice that if I have my CSS files aggregated
I'm using Drupal 6. I have a custom view that needs to be filtered
I was wondering how teams that develop sites using Drupal (or any other CMS)
I just saw that whitehouse.gov is using drupal as a CMS and portal technology.
Drupal is very much a Do Everything CMS. There are modules that allow you
Using Drupal 6, I'm trying to create a page with views that shows something
Im using Drupal 6.x. In my page i have the following code which prints
Using Drupal 7, I have a content type: Movie, It has a taxonomy of
I'm using Drupal 7. My bg image in page.tpl.php file and image get to

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.