JAVASCRIPT - REMOVE ALL BLANK/EMPTY STRING LINES FROM TEXTAREA - Javascript Source Code
JAVASCRIPT - REMOVE ALL BLANK/EMPTY STRING LINES FROM TEXTAREA AND PLACE CLEANED STRING BACK INTO TEXTAREA
Home
Short:
// ASSUMING ID OF TEXTAREA IS [idOfTextArea] var varTextArea = document.getElementById("idOfTextArea"); // IN ONE LINE OF CODE, ALL LINES OF THE TEXTAREA THAT ARE BLANK/CONTAIN EMPTY STRING REMOVED varTextArea.value = varTextArea.value.replace(/^\s*[\r\n]/gm, "").trim();
TEST AREA
Remove Blank/Empty String Lines from Textarea
Reset/Start Over
source code home