标签:color multipart name code meta button push inpu function
<!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>
jquery获取多个相同name的input框的value值
标签:color multipart name code meta button push inpu function
原文地址:https://www.cnblogs.com/pypua/p/13131836.html