I'm trying to mimic the tags feature on Stack Overflow where when you click the space button on the text box, it adds a blue border to the previous text in the textbox and adds an X button besides it to remove it if wanted.
Here is an image example of what I'm trying to do:
.
Here is what I have so far. If someone can help me, I would really appreciate it.
<input id="tags">
<script>
document.getElementById("tags").addEventListener('keydown', function (event) {
if (event.keyCode === 32) {
// what do I fill in here??
}
});
</script>