JAVASCRIPT - PLACE ALL NON-BLANK/NON-EMPTY LINES FROM TEXTAREA IN ARRAY - Javascript Source Code
JAVASCRIPT - TAKE ALL LINES FROM A TEXTAREA THAT ARE NOT BLANK AND DO NOT CONTAIN STRINGS OF EMPTY TEXT INTO AN ARRAY
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 NOT EMPTY ARE PLACED IN ARRAY var varArrLines = varTextArea.value.replace(/^\s*[\r\n]/gm, "").trim().split("\n").filter(line => line);
TEST AREA
Place Non Blank/Non Empty Lines of Textarea in Array
Reset/Start Over
source code home