I have this code:
$(\"#test\").siblings(\'p\').remove(); $(\"#test\").remove();
How can I chain this code instead of writing it separately?
I have to agree with the comment on the question; for readability and maintainability, use andSelf:
$("#test").siblings('p').andSelf().remove();
Unfortunately, it's been deprecated. But if you're stuck on an older version of jquery like we are, it may be worthwhile.