• 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
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.


Digg   Delicious   Reddit   Facebook   Twitter   StumbleUpon  


  Theme © 2014 iAndrew  
Powered By MyBB, © 2002-2019 MyBB Group.