1

I want to add both an ID and NAME for my drop down (so that I could get the value using jQuery. but it seems that CI won't allow. Is there another way?

$device = array(
        'name'  => 'device',
        'id'    => 'device'

      );
$device_opts = array(
              'monitor'  => 'Chair',
              'keyboard'    => 'Keyboard',
              'mouse'    => 'Mouse',
              'table'   =>  'table',
              'UPS'     =>  'UPS',
            );  


echo form_dropdown($device, $device_opts);

2 Answers 2

1

try this

echo form_dropdown("device", $device_opts,"","id='device'");
Sign up to request clarification or add additional context in comments.

Comments

1

Try like

$device = array(
    'id'    => 'device'
  );
form_dropdown('device', $device_opts, '', $device);

You need to give name as first option for the DropDown and the remaining will come under extra options for that DropDown

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.