I have this code:
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Bad Grammar Generator</title>
</head>
<body>
<input type="text" id="userIn">
<input type="button" name="name" id="btn" value="Bad Grammar-ify" onclick="badgrammar()">
<span id="output"></span>
<script type="text/javascript">
var userIn = document.getElementById("userIn").value;
function badgrammar() {
var userIn = document.getElementById("userIn").value;
var output = document.getElementById("output");
var split = new Array();
split = userIn.split(" ");
output.innerText = split;
}
</script>
</body>
</html>
It works, but it splits user input into one word. How can I make it split user input down to the letter?
Example:
Input: Hi there
Output: H,i,t,h,e,r,e