This here is my code.
$(document).ready(function(){
$(".btn.btn-default.btn-lg.remove").click(function(){
$(this).parent().remove();
});
});
I want the entire div to get deleted when the button of class="btn btn-default btn-lg remove" gets clicked. I cant use id because i am dynamically appending the above div using append jquery.
Answer
You can use closest
$(document).ready(function(){
$(".btn.btn-default.btn-lg.remove").click(function(){
$(this).closest('.row').remove();
});
});
No comments:
Post a Comment