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