1
I want to get the object of the second input. As I have more inputs with the 'check-date2' class, I want to pick up the element immediately after the first.
HTML
<div class="form_line">
<div class="column-50">
<div class="line_desc">
Data Início<font>*</font>
</div>
<div class="line_field">
<div class="form-group">
<input id="datepicker1"
class="form-control input date-check check-date"
placeholder="Data Início - DD-MM-YYYY" type="text"
name="event_date_start">
</div>
</div>
</div>
<div class="column-50">
<div class="line_desc">
Data Fim<font>*</font>
</div>
<div class="line_field">
<div class="form-group">
<input id="datepicker2"
class="form-control input date-check check-date2"
placeholder="Data Fim - DD-MM-YYYY" type="text"
name="event_date_end">
</div>
</div>
</div>
</div>
No . js have this:
$(".check-date").on("change", function() {
checkIfSecondDateIsGreaterThanFirst(this);
});
And the function that should pick up the input object:
function checkIfSecondDateIsGreaterThanFirst(date) {
/**
* to verify that the second data is greater than the first
*/
var next_date = $(date).next('.check-date2');
alert($(next_date).attr('class'));
}
That’s what I wanted, it’s working ?
– M_b_85
@M_b_85 in time of
.next()
uses.prev()
.– Sergio