I have a small quiz and am trying to get it so that after a user enters their answer, they can click submit button or press the enter key on their keyboard. I have tried using a callback function to capture both instances.
        <form>
            <input id="answer"></input>
            <button id="btn" class="submit">SUBMIT</button>
        </form>
        var callback = function() {
            var myAnswer = document.getElementById('answer').value;
            if (myAnswer == "y" || myAnswer == "Y" ) {
                $('.content-bd').html("<p>Well done!<p>");
            }
            else {
                $('.content-bd').html("<p>Try again<p>");
            }
        };
        $("input").keypress(function() {
            if (event.which == 13) callback();
        });
        $('#btn').click(callback);
 
     
     
     
    