How to add onclick function in moodle select box

How to add onclick function in moodle select box

by Ravi kumar -
Number of replies: 0

while i am selecting country, based on that users should in moodle custom plugin. For that i need to use onclick function in dropdown box. Please help.

I have written my code in below for your reference.

 $choices = array('' => get_string('selectacountry')) + $choices;

            $mform->addElement('select', 'country', get_string('country','local_diary_module'), $choices, $purpose);

            $mform->getElement('country')->setMultiple(true);

            if (!empty($CFG->country)) {

                $mform->setDefault('country', core_user::get_property_default('country'));

            }

            $mform->setDefault('country', $country);


Average of ratings: -