I was wondering what you are trying to achieve in the following lines of code,
var option = new Option(optionData.Text, optionData.Value); selectList.add(option, null);
Are you trying to create an option and then add it to select ? if yes, do it like this, use .append()
selectList.append(option);
with this, I still assume that new Option(optionData.Text, optionData.Value); creates a new option , in jQuery it will look like var option = $('<option>').text(optionData.Text).val(optionData.Value);
added notes for .add() ,
var selectList = $("#subCategories");
The workaround is
selectList[0].add(option, null);
difference between:
source share