CodeIgniter Forums
How shall i add class[CSS] in dropdown - Printable Version

+- CodeIgniter Forums (https://forum.codeigniter.com)
+-- Forum: Archived Discussions (https://forum.codeigniter.com/forum-20.html)
+--- Forum: Archived Development & Programming (https://forum.codeigniter.com/forum-23.html)
+--- Thread: How shall i add class[CSS] in dropdown (/thread-6763.html)



How shall i add class[CSS] in dropdown - El Forum - 03-11-2008

[eluser]Sumon[/eluser]
This is the way to create drop down in codeigniter:
$options = array(
'small' => 'Small Shirt',
'med' => 'Medium Shirt',
'large' => 'Large Shirt',
'xlarge' => 'Extra Large Shirt',
);
echo form_dropdown('shirts', $options, 'large');

How shall i add class[CSS] for this which will produce:
<select name="shirts" class="listShift">

For your kind information i need the solution of Class not Style.

Thanks


How shall i add class[CSS] in dropdown - El Forum - 03-11-2008

[eluser]xwero[/eluser]
There is a fourth parameter where you can add a string with attributes. In your case it would be
Code:
$options = array(
‘small’ => ‘Small Shirt’,
‘med’ => ‘Medium Shirt’,
‘large’ => ‘Large Shirt’,
‘xlarge’ => ‘Extra Large Shirt’,
);
echo form_dropdown(’shirts’, $options, ‘large’,'class="listShift"');



How shall i add class[CSS] in dropdown - El Forum - 03-11-2008

[eluser]Sumon[/eluser]
Thanks..... This is exactly what i was searching. Thanks.