我有一些:由wordpress初始化的複選框元素。 現在我設定.buttonset()函數來#format但這不是工作... 這樣的例子:http://jqueryui.com/button/#checkbox無法在jQuery上運行.buttonset()
HTML:
<div id="format">
<?php
$categories = get_categories();
foreach ($categories as $category) { ?>
<input type="checkbox" name="check" value="<?php echo $category->cat_ID; ?>">
<label><?php echo $category->cat_name;?></label><?php } ?>
</div>
JS:
$('#format').buttonset();
$('input[type=checkbox]').removeClass('ui-helper-hidden-accessible');
$(':checkbox[name=check]').each(function(i){
var nameID = 'check'+ (i+1);
this.id = nameID;
$(this).next('label').prop('for', nameID);
});
你會得到任何錯誤..檢查你控制檯 – bipen 2013-05-04 17:03:34
是否包裝在'document.ready'中? – charlietfl 2013-05-04 17:07:03
@bipen與螢火蟲沒有錯誤 – pouya 2013-05-04 17:08:59