Communities for your favorite technologies. Explore all Collectives
Stack Overflow for Teams is now called Stack Internal. Bring the best of human thought and AI automation together at your work.
Bring the best of human thought and AI automation together at your work. Learn more
Find centralized, trusted content and collaborate around the technologies you use most.
Stack Internal
Knowledge at work
Bring the best of human thought and AI automation together at your work.
Every searches I made only included solutions for variables like this: $('#div'+ id)
I need to delete a row.
var row = $(this).parent().parent().parent().find('tr#' + id).html();
I'd like to use the "row" name instead of "$(this)...remove();"
like
$('tr[name='+rowname+']').remove()
Add a comment
use .closest, it is safer than all those chained parent calls in case you change the markup which will break the code.
var row = $(this).closest('tr'); row.remove()
Just populate the row var with a reference to the row.
var row = $(this).parent().parent().parent().find('tr#' + id); var html = $(row).html(); $(row).remove();
Required, but never shown
By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.
Start asking to get answers
Find the answer to your question by asking.
Explore related questions
See similar questions with these tags.