I want getting all value in inputs except the last input in last class .tr by jquery, but it don’t work for me, How can fix it?
I try as:
DEMO: http://jsfiddle.net/d4xZK/
HTML:
<div class="tr">
<input type="text" value="111">
</div>
<div class="tr">
<input type="text" value="222">
</div>
<div class="tr">
<input type="text" value="333">
</div>
<div class="tr">
<input type="text" value="444">
</div>
jQuery:
$('.tr').each(function(){
var mpiVal = $('.tr input').not(':last').val();
alert(mpiVal)
)}
You can
slice()off the last one:Demo