I cannot seem to be able to hit enter and let it do the same as click button *FIXED

I cannot seem to be able to hit enter and let it do the same as click button *FIXED
0

#1

im doing the wikipedia viewer thingy. i need help when press key"enter" do the same as clicking on button and if u have any suggestion on how to make the code look nicer please do so and if u do it would be nice if you could explain how and why it work that way.


#2
$("#input").keydown(function(event){
    if(event.keyCode == 13){
        event.preventDefault();
        $("#btn").click();
    }
});

#3

Thanks alot!!! <3