0
這裏的,剝離下來,代碼:需要一些幫助,我的jQuery的輸入斯泰勒
$(document).ready(function()
{
var $input = $('input[type="checkbox"]');
$input.wrap('<div class="stylecheck-container" style="display: inline" />').addClass('stylecheck').hide();
$container = $input.parent('div.stylecheck-container');
if ($container.parent('label').length > 0)
{
$container.append($container.parent('label').text() + ' ');
$container.parent('label').replaceWith($container);
}
$input.change(function()
{
alert(1);
});
$container.click(function()
{
if ($input.is(':checkbox'))
{
if ($input.is(':checked'))
$input.attr('checked', true);
else
$input.attr('checked', false);
}
});
});
我遇到的問題是,當我嘗試刪除父標籤,變化不再被檢測到。
如果我註釋掉第6行if語句,它可以正常工作。
這是怎麼回事?
剛剛嘗試過它 - 沒有解決它。我看不出爲什麼刪除標籤會導致代碼失敗:/ – dave 2010-08-04 07:09:46