I want to get input of every form in my page that their name is name
my forms are like this
<form class="form" role="form" onsubmit="completeSave(this)">
<div class="form-body">
<div class="form-group">
<label>name</label>
<input type="text" class="form-control" name="name"
value="{{$media->name}}">
</div>
</div>
</form>
// next form!
<form class="form" role="form" onsubmit="completeSave(this)">
<div class="form-body">
<div class="form-group">
<label>name</label>
<input type="text" class="form-control" name="name"
value="{{$media->name}}">
</div>
</div>
</form>
I already have some code that do something with each form (an ajax request ) but I want to have a button in a page that submit all forms data
<button class="btn btn-primary" onclick="completeSaveAll()">submit</button>
i tried this javascript code :
function completeSaveAll() {
var form = $('form');
form.each(function () {
console.log(this.find("[name=name]"));
})
}
but it doesn't work how can I do it?