I am getting the last element of the form which has got value, now i want to find the id of next input element which is in next div…
var elem1 =$(':text[name^=distanceSlab][value!=""]').last();
var nextElemId = // find the id of next input element which is in next div
the corresponding html code is
<div id ="divid4">
<input type="text" id ="slab4" value ="1"/> // this is the last elemnt which has value
</div>
<div id ="div1d5">
<input type="text" id ="slab5" value =""/> // need to find the id of this element
</id>
Assuming that you’re starting from the
inputthat you’ve already identified, then:JS Fiddle.
Or:
JS Fiddle.
I’d probably put those into a
blur(), or similar, event.