我试图在输入字段中获取文本的值.在jquery中执行此操作的最佳方法是什么.我试过.text()它不起作用.
`
<html>
<head>
<title></title>
<script type="text/javascript" src="js/jquery.js"></script>
<script type="text/javascript">
$(document).ready(function(){
var t = $(":input").text();
alert(t);
});
</script>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
</head>
<body>
<form name="f">
<input type="text" name="t" value="cake">tes</input>
</form>
</body>
</html>
Run Code Online (Sandbox Code Playgroud)
`
穿着库克