Bootstrap: How to assign id to button?

I’ve started using the twitter bootstrap and find it very helpful. However, I’m stuck trying to use the toggle button that I’ve planted on my page, because I can’t assign an id to it. I tried this:

<?php $this->widget('bootstrap.widgets.BootButton', array(



                    'label'=>'Toggle Session Data',



                )); ?>

But I still don’t get an id on my button. Can I get this button to have an id? How else would I attach my event listener?


Eventually figure it out:

<?php $this->widget('bootstrap.widgets.BootButton', array(

        'label'=>'Configure Columns',

        'type'=>'info', // '', 'primary', 'info', 'success', 'warning', 'danger' or 'inverse'

        'size'=>'small', // '', 'large', 'small' or 'mini'


    )); ?>

Stuff like id goes into the htmlOptions, which isn’t in the BootStrap extension example (not for the buttons anyways) so it took me a while to figure it out.

1 Like

good you figured it out, all html related stuff always goes into the htmlOptions array.

think of it as everything you would set directly into the html element. id,class,name,style etc etc.