我觉得发布这个有点傻,因为从我一直在阅读的内容来看,这似乎很简单,但我不知道为什么我总是1
将files.length
.
<html>
<head>
<script src="http://code.jquery.com/jquery-1.7.2.js" type="text/javascript"></script>
<script>
$(document).ready(function() {
var button = $('#button');
button.click(function(){
var files = $('#files');
alert(files.length);
});
});
</script>
</head>
<body>
<form>
<input type="file" id="files" multiple="" />
<input type="button" id="button" value="Upload" />
</form>
</body>
</html>