//html <div class="posts"> <div class="post"> Some text for first div <a class="remove">remove</a> <hr> </div> <div class="post"> Some text for second div <a class="remove">remove</a> <hr> </div> <div class="post"> Some text for third div <a class="remove">remove</a> <hr> </div> </div> // jQuery $('.remove').live('click', function() { var postHTML = $(this).html(); // select only "a" element });
$('.remove').click(function () { var postHTML = $(this).closest(".post").html(); // select closest div or element with class post });
$('.remove').live('click', function () { $('.post:eq(1)').html(''); });
var
This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)