<!DOCTYPE html>
<html>
<head lang="en">
<meta charset="UTF-8">
<title></title>
</head>
<body>
<form id="form" method="post" action="/test2.php">
<input type="text" name="tags[2]">
<input type="text" name="tags[4]">
<input type="text" name="hello">
<input id="submit" type="button" value="submit">
</form>
<div>
<?php print_r($_POST); ?>
</div>
<script src="/js/jquery-1.11.2.min.js"></script>
<script>
$('#submit').click(function(){
$('#form').submit();
});
</script>
</body>
</html>
我将一个类型为type的button给了id值submit,网上搜了下,好像是这样做不行,不知道可以怎样解决呢?
没看出有什么问题,不过为啥不直接把input的type设为submit