Skip welcome & menu and move to editor
Welcome to JS Bin
Load cached copy from
 
<!DOCTYPE html>
<html>
    <head>
        <script src="//code.jquery.com/jquery-2.1.1.min.js"></script>
        <meta charset="utf-8">
        <title>JS Bin</title>
    </head>
    <body>
        <form action="">
            <textarea name="" id="" cols="30" rows="10"></textarea>
            <input type="submit">
            
        </form>
    </body>
</html>
 
$(function() {
    
    $(window).keydown(function(event){
        if(event.which == 13 && !$(event.target).is("textarea")) {
            event.preventDefault();
            console.log("ENTER PREVENTED");
            return false;
        }else{ // just to test
            console.log("ENTER was in textarea");
        }
    });
    
});
Output

You can jump to the latest bin by adding /latest to your URL

Dismiss x
public
Bin info
anonymouspro
0viewers