I have a page with mutiple inputs,each input has a button. is there anyway of getting the inputs value on button click, without hardcoding the inputs id?
.prev doesnt work as there is a span directly after input
example
js
$('button').click(function () {
var inputcontent = $(this).prev('input').attr('id');
console.log(inputcontent);
});
html
<input type="text" id="1">
<span class="input-group-btn">
<button type="button">Go!</button>
</span>