doesn't work .buttonset() on jQuery with wordpress

doesn't work .buttonset() on jQuery with wordpress



I have a number of :checkbox elements that are initialized by a wordpress. Now i set .buttonset() function to #format but this is not work... like this sample:http://jqueryui.com/button/#checkbox

HTML:

  1.     <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 } ?>
            *//ADD STATIC HTML:*
           <input type="checkbox" id="id" /><label for="id">B</label>
        </div>










Jquery:

  1.    $('#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);
        });







if i'm added a :checkbox element with static HTML it's worked well.

  1.     `<input type="checkbox" id="id" /><label for="id">U</label>`

and this is generated HTML:

  1.     <div id="format" class="ui-buttonset">
            <input type="checkbox" name="check" value="3" class="check" id="check1">
                  <label for="check1">
                  <span class="ui-button-text">CAT1</span>
                  </label>      
             <input type="checkbox" name="check" value="4" class="check" id="check3">
                  <label for="check3">
                  <span class="ui-button-text">CAT2</span>
                  </label>              
            <input type="checkbox" name="check" value="5" class="check" id="check4">
                 <label for="check4">
                 <span class="ui-button-text">CAT3</span>
                 </label>              
            <input type="checkbox" id="id" class="">
                 <label for="id" class="ui-button ui-widget ui-state-default ui-button-text-only ui-corner-right ui-corner-left" role="button" aria-disabled="false" aria-pressed="false">
              <span class="ui-button-text">B</span></label>

    </div>