I need to submit the text within the input field by pressing the enter key,and then put the form text into a list item. Problem is,when I press enter it just refreshes the page and nothing happens,and I cna't use anything back-end ,this is purely front-end... this is a to-do list by the way,and this is what I've done so far:
<html>
    <head>
        <title>Site</title>
        <meta name="viewport" content="width=device-width,initial-scale=1,maximum-scale=1,user-scalable=no">
        <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
        <meta name="HandheldFriendly" content="true">
        <meta charset="UTF-8">
        <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/4.7.0/css/font-awesome.min.css">
        <link rel="stylesheet" type="text/css" href="style.css">
        <link href="https://fonts.googleapis.com/css?family=Montserrat" rel="stylesheet">
        <link href="https://fonts.googleapis.com/css?family=Roboto" rel="stylesheet">
        <link rel="stylesheet" href="style.css">
    </head>
    <body>
        <div class="container">
            <div class="text">
                 <h1>To-Do</h1><br>
            </div>
            <form>
                <input type="text" id='uzd' placeholder="Ką reikia atlikti?">
                <button type="submit" form="uzd" value="Submit" hidden onsubmit="button()"></button>
            </form>
            <ul id='uzduotys'>
            </ul>
            <script src="script.js"></script>
        </div>
    </body>
</html>
function button(){
    var node = document.createElement("Li");
    node.setAttribute("class","li-item");
    var text = document.getElementById("uzd").value;
    if(text===""){
        alert("placeholder");
    }
    else{
        var textnode =document.createTextNode(text);
        node.appendChild(textnode);
        document.getElementById("uzduotys").appendChild(node);
    }
}
var list = document.querySelector('ul');
list.addEventListener('click', function(ev) {
    if (ev.target.tagName === 'LI') {
        ev.target.classList.toggle('checked');
    }
}, false);