Reputation: 249
Is there any possible way of adding class and id attributes in form_dropdown of CodeIgniter?
I tried form_dropdown('name',$array,'class','id')
and it's not changing anything, please tell me how to implement it?
Edited:
with my dropdown form like this form_dropdown('name',$array,set_value('someValue'),'id="myId"');
if I see my source from my browser it's look like this <select name="provinsi" id="provinsi_id">
, but if I write like your way form_dropdown('name',$array,set_value('someValue'),'class="myClass"','id="myId"');
than like this in my browser source <select name="provinsi" class="myClass">
that was I mean
thank you
Upvotes: 11
Views: 29834
Reputation: 2557
You can defined class, id or any other HTML attribute in the forth parameter of form_dropdown()
function as an associative array like below:
form_dropdown('name', $array, set_value('someValue'), ['class' => 'myClass', 'id' => 'myId']);
Upvotes: 0