Skip to content

24 ways to impress your friends

Vote down?

Jeremy Keith

CornedBee: You’re almost there, but the syntax for insertBefore is actually more complex than that (unnecessarily so in my opinion). But your thinking is spot on: use either insertBefore (if the quote has a nextSibling) or appendChild (if the quote is the lastChild).

Si: Yes, a more descriptive link text would be good. That was why I suggested reusing a quote’s title attribute, if one exists.