输入的输入值将返回为undefined.我已经看到过这样的其他问题,但没有任何效果.无论如何,当我使用我的jQuery它总是给我undefined.
jQuery的:
$( document ).ready(function() {
$('#Input').keypress(
function(e){
if (e.keyCode == 13) {
alert( ">" + $("#Input").value );
}
});
}); Run Code Online (Sandbox Code Playgroud)
<!DOCTYPE html>
<html>
<style type="text/css">
body{
background-color: black;
color: #00c600;
font-family: VT323;
}
input{
background-color: black;
color: #00c600;
font-family: VT323;
border:none;
width: 98%%;
height: 30px;
font-size: 20px;
border: 2px black;
float: left;
margin-left: 10px;
list-style-type: none;
position: absolute;
bottom: 17px;
}
input:focus {
outline: 0;
}
h1{
text-align: center;
font-size: 50px;
}
h2{
padding-left: 20px; …Run Code Online (Sandbox Code Playgroud)