Welcome Guest, Not a member yet? Register   Sign In
How to style timezone_menu()
#1

(This post was last modified: 02-02-2015, 02:03 AM by behnampmdg3.)

Hi;

How can I add a class to the drop down created by timezone_menu()?

This doesn't seem right:

$this->data['timezones'] = timezone_menu('','form-control');

Thanks
Reply
#2

Control styles are done using CSS styles.
What did you Try? What did you Get? What did you Expect?

Joined CodeIgniter Community 2009.  ( Skype: insitfx )
Reply
#3

(02-02-2015, 05:53 AM)InsiteFX Wrote: Control styles are done using CSS styles.
How can I add id?
Reply
#4

The code does look correct (the timezone function usage). Is there any output displayed?
Reply
#5

Hard to know without seeing your timezone_menu() code. Like is it outputting HTML, using the form_dropdown() helper, or what?

But using CI's native form_dropdown(), it would be (just like the docs state) entering the custom id/class/other attributes in the 4th parameter.
Code:
echo form_dropdown('name_of_dropdown', $dropdown_value_array, $selected_value, 'id="my-id" class="some-class"');
Reply
#6

timezone_menu('','form-control'); should generate something like:
Code:
<select name="timezones" class="form-control">
   <option value="UM12">(UTC -12:00) Baker/Howland Island</option>
   <!-- ... etc. -->
</select>

So you should be able to apply your desired styles to the form-control class.
Reply




Theme © iAndrew 2016 - Forum software by © MyBB