I have a series of jQuery appends that look like this:
moveControls.append("<span>").find("span").last().addClass("absLeft").text("«");
moveControls.append("<span>").find("span").last().addClass("left").text(" ‹ ");
moveControls.append("<span>").find("span").last().addClass("right").text(" › ");
moveControls.append("<span>").find("span").last().addClass("absRight").text("»");
And, writing it out, it seems... Messy, or convoluted. It works perfectly, but I was wondering if there was anything I should be doing instead. Maybe an 'append to' but I still would need to construct the s.
My biggest problem goes with the Append -> Finding the element I just added -> Getting the last element -> Adding classes + text.
I've repeated it several times through out my code, but as a novice, I was just wondering if there was a more efficient way to doing this.
If this is too broad of a question, I apologize. New to Stackoverflow, and this has been a concern for me.