0

How do I add a class to a form_dropdown in CodeIgniter if I also have a Javascript attached. Here is my code:

$language = array(
                        'select' => 'Select Language',
                        'chinese' => '中文',
                        'english' => 'English',
                        'french' => 'Français',
                        'german' => 'Deutsch',
                        'italian' => 'Italiano',
                        'japanese' => '日本',
                        'korean' => '한국어',
                        'polish' => 'Polska',
                        'portuguese' => 'Português',
                        'russian' => 'Росс&#1048Ю',
                        'spanish' => 'Español'       
                    );

    $js = 'onChange="this.form.submit()"';              
    echo form_dropdown('language', $language, 'select', $js);

1 Answer 1

1

Add the class to the $js variable;

$js = 'onChange="this.form.submit()" class="myClass"';
Sign up to request clarification or add additional context in comments.

1 Comment

Worked like a charm. Thanks, Rocket.

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.