为什么.next()返回'undefined'? http://jsfiddle.net/radek/sD6JB/2/为什么.next()给我'undefined'
HTML
<button value="login|basic" class="square_button button_background" type="button"> run </button>
<input name="restore" title="restore before ant run" type="checkbox">
<button value="test|advanced" class="square_button button_background" type="button"> run </button>
<input name="restore" title="restore before ant run" type="checkbox">
<button value="best|4444" class="square_button button_background" type="button"> run </button>
<input name="restore" title="restore before ant run" type="checkbox">
<div id='results'/>
的JavaScript + jQuery的
$(document).ready(function(){
$('button[type=button]').click(function(){
var params = $(this).val();
document.getElementById("results").innerHTML+=
"<BR>"+params.split('|')[0]+" - "
+ params.split('|')[1]+" - "
+ $(this).next().checked;
});
});
为什么你甚至首先有'
“按钮_按钮。”大声笑! – sscirrus 2011-05-31 07:11:52
@BoltClock'button'的默认'type'属性是'submit'。 [来源](http://www.w3.org/TR/html401/interact/forms.html#h-17.5)。 – alex 2011-05-31 07:15:23