Currently, I am dealing with two CSS classes: .dragbox and .removebutton.
The .dragbox represents a div, while the .removebutton is a button nested within the div.
On my page, there are multiple dynamically generated instances of .dragbox.
I am seeking a way to use JavaScript to ensure that only the .removebutton associated with the current .dragbox is visible.
At the moment, whenever I hover over a .dragbox, all the .removebuttons become visible for every .dragbox on the page. I aim to have only the specific one show up.
Below is the snippet of the CSS:
.dragbox {
position:absolute;
width:10px;
height:25px;
padding: 0.0em;
margin:25px;
}
.removebutton {
background-image:url(img/delete.png);
background-repeat:no-repeat;
visibility:hidden;
}
And here is the corresponding JavaScript code:
$('.dragbox').hover(function() {
$(this).css('border', '1px solid #000');
$(this).css('background-image','url(img/move.png)');
$(this).css('background-repeat','no-repeat');
$(this).css('width', '15px');
$(this).css('height', '15px');
$(".removebutton").css('visibility', 'visible');
});