Welcome Guest, Not a member yet? Register   Sign In
How shall i add class[CSS] in dropdown
#1

[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
#2

[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"');
#3

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




Theme © iAndrew 2016 - Forum software by © MyBB