Welcome to my first post! As a newbie in web development, I have just started my first project. While I feel comfortable with HTML and CSS, jQuery is proving to be a bit challenging for me.
In the head section of my intranet page, I have the following code:
JQUERY
$(document).ready(function(){
$("#flip").click(function(){
$("#panel").slideToggle("fast");
});
});
Additionally, I've included this code in the body:
HTML
<div class="announcements">
<div id="flip">
<h2 class="announcements">title here</h2>
<div class="announcesig">
Informed by: name here<br>Date: date here
</div>
</div>
<div id="panel">
<p>comment here<br>
more comment
<a target="_blank" href="link here">Click Here</a></p>
</div>
</div>
Although this setup works perfectly for the first announcement, it fails when I try to replicate it for another
<div class="Announcements">
. The format remains consistent but the functionality does not extend beyond the initial one.
Question
Do I need to create a separate script for each announcement by using identifiers like #flip1
, #flip2
, along with specific CSS and HTML configurations? Or is there a simpler approach that I am missing?
I apologize if my explanation is unclear.