Why doesn't the javascript from w3schools.com ever seem to work in Squiffy?

In w3schools.com, you can separate two words in an input like this:

<!DOCTYPE html>
<html>
<body>



<p>What is your first and last name?</p>
<input id="firstlast" name="firstlast">
<button onclick="myFunction()">Try it</button>
<p id="first"></p> 
<p id="last"></p>

<script>
function myFunction() {
  var firstlast = document.getElementById("firstlast").value;
  var first = firstlast.split(/ +/)[0];
  var last = firstlast.split(/ +/)[1];
  document.getElementById("first").innerHTML = first;
  document.getElementById("last").innerHTML = last;

}
</script>

</body>
</html>

Nothing remotely similar seems to work in Squiffy. Does anyone know why this is? How can I get Squiffy to do the same thing?

Thanks!


Log in to post a reply.

Support

Forums