<!DOCTYPE html> <html lang="zh"> <head> <Meta charset="UTF-8"> <title>Document</title> </head> <script src="http://www.jq22.com/jquery/jquery-3.3.1.js"></script> <body> <form method="post" enctype="multipart/form-data"> 早餐:<input type="text" name="goods" /><br> 午餐:<input type="text" name="goods" /><br> 晚餐:<input type="text" name="goods" /><br> <input type="button" name="sub" class="sub" value="提交" /> </form> </body> <script> $('.sub').click(function () { var arr =[]; $("input[name='goods']").each(function(){ arr.push($(this).val()); }) console.log(arr); }); </script> </html>