【发布时间】:2013-05-04 16:59:28
【问题描述】:
我有许多由 wordpress 初始化的 :checkbox 元素。 现在我将 .buttonset() 函数设置为 #format 但这不起作用... 喜欢这个样本:http://jqueryui.com/button/#checkbox
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);
});
【问题讨论】:
-
您是否遇到任何错误.. 检查您的控制台
-
代码是否包含在
document.ready中? -
@bipen with firebug 没有错误
-
doesn't work的解释不多。你是否包含了 jQuery UI css? -
@charlietfl 是的,我确定...
标签: javascript jquery wordpress jquery-ui wordpress-theming