There's three input fields inside '.edit'. How to get the value of each one of them using jQuery?
$submit.click(value);
function value () {
for (var i = 0; i < 3; i++) {
var $input = $('.edit').children('input').eq(i).val();
console.log($input);
}
}
<div class="edit">
<h3>Headline</h3>
<span>Text</span>
<input type="text" id="one">
<span>Text</span>
<input type="text" id="two">
<span>Text</span>
<input type="text" id="three">
<button class="submit">Submit</button>
</div>
Doesn't work. Why? And also is it possible to set a default value: .val() || 'unknown'
?
.edit
element?$submit
?