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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T21:20:51+00:00 2026-05-26T21:20:51+00:00

I’m wondering how I can show multiple divs after a user clicks on an

  • 0

I’m wondering how I can show multiple divs after a user clicks on an img link “importantImg” below using jquery (importantImg isn’t below but is in my program). The problem is that this is just one snippet of the entire page that also has divs, so I don’t want to make my select be “div,” I just want to interact with these 4 specific divs. Here’s the html that contains the 5 divs:

<div id="divLayer1">
<div id="divLayer2" class="alertPod">
    <img src="<%= Page.ResolveUrl("~/{0}/_res/_images/icon_alertMessage.png",   PBS.Cms.Settings.PBSFolderName) %>" />

</div>

<div id = "divLayer3" class="msgPod">
    <div id= "divLayer4" class="messageWrapper">
        <h6>IMPORTANT ANNOUNCEMENT</h6>
        <div class="box">         
            <div id="divLayer5" class="viewport" style="overflow: auto; height: 48px;"  runat="server">
                <p> <%--id= "importantMessage">--%> 
                <asp:Literal ID="ltimportantannouncementTitle" runat="server"></asp:Literal>
                <br />
                <asp:Literal ID="ltimportantannouncementSummary" runat="server"></asp:Literal>
                </p>
            </div>
        </div>
    </div>
    <a href="#" ><img id="alertCloseBtn" src="<%= Page.ResolveUrl("~/           {0}/_res/_images/button_alertMsgClose.png", PBS.Cms.Settings.PBSFolderName) %>" /></a> 

Here’s the jquery script I’m using that isn’t working:

<script type="text/javascript">
    $(document).ready(function () {
        $("img#importantImg").click(function () {                
            $("#divLayer1").show(); 
            $("#divLayer2").show(); 
            $("#divLayer3").show();
            $("#divLayer4").show();
            $("#divLayer5").show();                                                
            $("#importantImg").attr("src", "<%=  Page.ResolveUrl("~/{0}/_res/_images/icon_alertMessage.png", PBS.Cms.Settings.PBSFolderName) %>");                               
        });
    });

</script>
  • 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-26T21:20:52+00:00Added an answer on May 26, 2026 at 9:20 pm

    Two things here:

    1) You don’t need to do a $(document).ready() for every function you have. You can do it once and then put everything inside that.

    2) Your example is a bit tricky, since this is a jQuery question and there’s ASP code in there. Here’s my interpretation of what you’re trying to do:

    Javascript:
    $(document).ready(function() {
    $(‘#show_message’).click(function() {
    $(‘.message’).html(‘This is an important message!’);
    $(‘.alert_pod’).show();
    });

            $('#hide_message').click(function() {
               $('.alert_pod').hide();
           });
        });
    

    HTML:

    Show Message

    Important Message Goes Here
    Hide Message

    I don’t know ASP (or whatever you’re using), but I suspect that the problem is that some of your elements don’t seem to have IDs. You’re calling them in the Javascript, but the JS can’t find the elements because there is no id=”importantImg” as near as I can tell.

    Hope that helps.

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

Sidebar

Related Questions

link Im having trouble converting the html entites into html characters, (&# 8217;) i
I have a jquery bug and I've been looking for hours now, I can't
I'm new to using the Perl treebuilder module for HTML parsing and can't figure
Does anyone know how can I replace this 2 symbol below from the string
I am reading a book about Javascript and jQuery and using one of the
That's pretty much it. I'm using Nokogiri to scrape a web page what has
For some reason, after submitting a string like this Jack’s Spindle from a text
I'm using v2.0 of ClassTextile.php, with the following call: $testimonial_text = $textile->TextileRestricted($_POST['testimonial']); ... and
I'm parsing an RSS feed that has an &#8217; in it. SimpleXML turns this
We're building an app, our first using Rails 3, and we're having to build

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.