1
I have two div
with #bodyProduct
, and inside each one has a div
with a div
with a #btn-extende
.
To div
father product has a height
fixed with overflow, hiding the rest of its contents and the button extende
is just to extend this div
for a height
auto, to show all the content, but the problem is that when I put the system to work by clicking on the first btn-extende
, It works, but when I click on the second btn
, rather than extend to div
to which he is inserted, he extends the first div
with the #bodyProduct
.
How do I affect only the div
father of btn
tight?
<div id="bodyProduct">
<div id="btn-extende">
</div>
</div>
<div id="bodyProduct">
<div id="btn-extende">
</div>
</div>
<style>
#bodyProduct{
position: relative;
width: 960px;
height: 295px;
margin: 20px 60px;
display: block;
overflow: hidden;
}
#btn-extende{
z-index: 9999;
position: absolute;
width: 35px;
height: 18px;
background-color: #555;
bottom: 6px;
right: 6px;
overflow: hidden;
}
</style>
$('btn-extende').on('click', function(){
$('#bodyProduct').css('height', 'auto');
});
The estate
id
must be unique on the page. There cannot be more than one element with the sameid
; the browser will only consider the first and ignore the rest.– Woss