Reputation: 3081
Is there a way I can show only the button to the box I'm hovering over without using the addclass() property and toggling the visibility. Is there a way to do something like $(this).('.list_remove').fadeIn("200");
what is the correct way to go about this?
(function(){
$('.list_remove').hide();
$(".boxes").hover(
function () {
$('.list_remove').fadeIn("200");
},
function () {
$('.list_remove').fadeOut("200");
}
);
})();
<div class="boxes">
<input type="button" class="list_remove" value="remove"> </div>
<div class="boxes">
<input type="button" class="list_remove" value="remove">
</div>
Upvotes: 2
Views: 64
Reputation: 4264
You can do that by specifying a context for jQuery to find the list-remove
button in.
$('.list_remove', this).fadeIn("200");
$('.list_remove', this).fadeOut("200");
Upvotes: 2
Reputation: 97672
You can specify a context to search so $('.list_remove', this).fadeIn("200");
will fade in .list_remove
descendents of the .boxes
$(".boxes").hover(
function () {
$('.list_remove', this).fadeIn("200");
},
function () {
$('.list_remove', this).fadeOut("200");
}
);
Upvotes: 3