The onclick event does not work for options

options don’t fire mouse events in chrome.

For a select element you’d use the onchange event on the select itself, and the value of the select will always be the same as the selected option

<select onchange="question_type(this.value);" name="qtype" id="qtype" class="form-control input-lg" required>
    <option value="">-- Select question type for this quiz --</option>
    <option value="mcq">1) MCQs</option>
    <option value="tf">2) True/False</option>
</select>

with jQuery it would be

$('select').on('change', function() {
    var selected = this.value;
});

Leave a Comment