为什么.next()给我'undefined'

Rad*_*dek 2 javascript jquery jquery-selectors

为什么.next()返回'undefined'?http://jsfiddle.net/radek/sD6JB/2/

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'/>
Run Code Online (Sandbox Code Playgroud)

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;
     });
});
Run Code Online (Sandbox Code Playgroud)

ale*_*lex 5

jQuery对象没有checked属性.

你可以......

(a)使用[0]或下标本机DOM元素get(0).

(b)访问prop('checked')(> =仅限jQuery 1.6.)

(c)使用is(':checked').