[Solved] jQuery Adding new option to select element doesn’t pick up the string [closed]


Change:

var str = $('#country-select').val() + " " + $("#" + $("#country-select option:selected").val() + "-select option:selected").val();

to:

var str = $('#country-select, .sub-menu').val() + " " + $("#" + $("#country-select option:selected").val() + "-select option:selected").val();

jFiddle example

You need to trigger the change on both the first and second selects, so $('#country-select, .sub-menu') is needed.

solved jQuery Adding new option to select element doesn’t pick up the string [closed]