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)
jQuery对象没有checked属性.
你可以......
(a)使用[0]或下标本机DOM元素get(0).
(b)访问prop('checked')(> =仅限jQuery 1.6.)
(c)使用is(':checked').
| 归档时间: |
|
| 查看次数: |
1531 次 |
| 最近记录: |