This might be a dumb question, but how to I add space gaps using split. I know it returns as an array, so I am not sure if its what I want to do. But this is what I am using right now:
var GetME = $("#textinput").val().split(" ");
So for example, give if the user inputs TEXTTEST, I want the GetMe var to hold T E X T T E S T, is this possible?
Thanks Glenn
Use split("") without the space to break up the string into the array. If you want to add spaces in between each letter, use join(" ")
"abcdefghij".split(""); //["a","b","c","d","e","f","g","h","i","j"]
"abcdefghij".split("").join(" "); // "a b c d e f g h i j"
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With