I am newly learning jQuery and java script,currently i am facing a problem in showing the hidden button,my html is
<span style="float:left;padding-right:10px">
<input type="button" value="image" class="delete" />
<a href="/media/image"><img src="/media/image" /></a>
</span>
<span style="float: left; padding-top: 5px;">
<a href="/media/image">
<button type="submit" class="delete_media">Delete</button>
</a>
</span>
Jquery:
$(".delete").click(function(){
var $this = $(this);
$this.siblings(".delete_media").toggle();
});
css:
.delete_media {
display:none;
float: right;
height: 25px;
width: 60px;
-moz-border-radius: 10px;
border-radius:10px;
}
Also i tried using find,nextAll,closest also nothing worked so how to make this work.
Demo Here
Try this
$this.closest('span').next().find(".delete_media").toggle();
DEMO
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With