Question

I know that this is most probably will be not that "clever" question, but i couldn't understand how this functions works, all i want from it, is just to remove <p> tags in the given table with class p_remove, here is my jquery code:

$(document).ready(function() {
    $('.p_remove').each( function(){
        $("<p>" + $('.p_remove').text() + "</p>").replaceWith("" + $('.p_remove').text() + "");
    });
});

this script is actually doesnt work, because the previous working scripts didnt work in the way i wanted them to work :) Thx for help!

Was it helpful?

Solution

$('.p_remove').each( function(){
    $self = $(this)
    $self.replaceWith( "<p>" + $self.text() + "</p>" );
});
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top