i want to show the hidden element with ID hidden_element
when i click the element with class show_hidden_element
, and close the element with ID hidden_element
when i click element with ID close_hidden_element
, if i just make one my script can work fine, but i have three element with same CLASS and ID, it cant work, somebody please help.
this is my script
<article class="post show_hidden_element">
<div id="hidden_element">
<div class="read_box">
<div class="read_box_content">
<h2 class="title">Lorem Ipsum</h2>
<a id="close_hidden_element" class="button_close">×</a>
</div>
</div>
</div>
<div class="border"></div>
</article>
<article class="post show_hidden_element">
<div id="hidden_element">
<div class="read_box">
<div class="read_box_content">
<h2 class="title">Lorem Ipsum</h2>
<a id="close_hidden_element" class="button_close">×</a>
</div>
</div>
</div>
<div class="border"></div>
</article>
<article class="post show_hidden_element">
<div id="hidden_element">
<div class="read_box">
<div class="read_box_content">
<h2 class="title">Lorem Ipsum</h2>
<a id="close_hidden_element" class="button_close">×</a>
</div>
</div>
</div>
<div class="border"></div>
</article>
my jQuery Script is
$(this).find(".show_hidden_element").click( function(){
$(this).find("#hidden_element").show();
});
$(this).find("#close_hidden_element").click( function(){
$(this).find("#hidden_element").hide();
});