0
Вот форма:Найти следующий родственный одного и того же типа элемента
<form>
<input type="text" name="name" id="name">
<label>Phone number *</label>
<input type="number" name="phone" id="phone">
<label>Email address *</label>
<input type="email" name="email" id="email">
<h3>Event</h3>
<label>Event type *</label>
<input type="text" name="type" id="type">
<input type="text" name="address" id="address">
<input type="date" name="date" id="date">
</form>
Я переменная инициализируется первый input
элемент:
var cur_input;
Я хочу, чтобы перебрать элементы формы, назначение следующий элемент ввода в переменную cur_input
на каждой итерации.
Я пробовал:.
cur_input = cur_input.next(); //failed because there are other elements in between
cur_input = cur_input.next('input'); //failed for some reason.
'cur_input.nextAll ('вход') первый()' https://api.jquery.com/nextAll/ – Satpal
/\ это ответ. – lucasnadalutti
@ Satpal это работает! Благодарю. – Ahtsham