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(

                    'buttonType'=>'button',

                    'type'=>'primary',

                    'label'=>'Toggle Session Data',

                    'id'=>'toggleb',

                    'toggle'=>true,

                )); ?>

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?

Thanks.

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'

        'htmlOptions'=>array('id'=>'test')

    )); ?>

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.