我在页面上有多个按钮,我想模拟点击NEXT按钮。jQuery点击下一步按钮
$('input, select').keydown(function(e){
if(e.which == 13)
//$('input[type*=button]').click();
$(this).next('input[type*=button]').click();
});
HTML:
<tr>
<td class="cell">
<input type="text" name="domain" class="entryfield" value="http://">
</td>
</tr>
<tr>
<td class="cell" align="right" colspan="2">
<input type="button" class="button" value="Get IP" id="submitDomain"/>
</td>
</tr>
注释的代码工作,但点击页面上的所有按键。
任何帮助表示赞赏,谢谢。
这取决于你的HTML是什么样子... – 2012-03-31 15:34:06
嘿@AndrewWhitaker,你能解释一下吗?我必须使用.parents()吗? – Prash 2012-03-31 15:38:05
您可能正在寻找以下按钮。但是'next('somehere')'只是一个条件语句。它不会自动给你下面的按钮。只是,如果下一个*是一个按钮,它将在下一步执行。 – Marnix 2012-03-31 15:39:57