Note that there are some explanatory texts on larger screens.

plurals
  1. POjquery show multiple layer divs
    primarykey
    data
    text
    <p>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:</p> <pre><code>&lt;div id="divLayer1"&gt; &lt;div id="divLayer2" class="alertPod"&gt; &lt;img src="&lt;%= Page.ResolveUrl("~/{0}/_res/_images/icon_alertMessage.png", PBS.Cms.Settings.PBSFolderName) %&gt;" /&gt; &lt;/div&gt; &lt;div id = "divLayer3" class="msgPod"&gt; &lt;div id= "divLayer4" class="messageWrapper"&gt; &lt;h6&gt;IMPORTANT ANNOUNCEMENT&lt;/h6&gt; &lt;div class="box"&gt; &lt;div id="divLayer5" class="viewport" style="overflow: auto; height: 48px;" runat="server"&gt; &lt;p&gt; &lt;%--id= "importantMessage"&gt;--%&gt; &lt;asp:Literal ID="ltimportantannouncementTitle" runat="server"&gt;&lt;/asp:Literal&gt; &lt;br /&gt; &lt;asp:Literal ID="ltimportantannouncementSummary" runat="server"&gt;&lt;/asp:Literal&gt; &lt;/p&gt; &lt;/div&gt; &lt;/div&gt; &lt;/div&gt; &lt;a href="#" &gt;&lt;img id="alertCloseBtn" src="&lt;%= Page.ResolveUrl("~/ {0}/_res/_images/button_alertMsgClose.png", PBS.Cms.Settings.PBSFolderName) %&gt;" /&gt;&lt;/a&gt; </code></pre> <p>Here's the jquery script I'm using that isn't working:</p> <pre><code>&lt;script type="text/javascript"&gt; $(document).ready(function () { $("img#importantImg").click(function () { $("#divLayer1").show(); $("#divLayer2").show(); $("#divLayer3").show(); $("#divLayer4").show(); $("#divLayer5").show(); $("#importantImg").attr("src", "&lt;%= Page.ResolveUrl("~/{0}/_res/_images/icon_alertMessage.png", PBS.Cms.Settings.PBSFolderName) %&gt;"); }); }); &lt;/script&gt; </code></pre>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload