AnsweredAssumed Answered

jquery code to remove / add options to dropdownlist (choice field)

Question asked by dhayanandkalimidi on Jul 18, 2017
Latest reply on Jul 19, 2017 by dhayanandkalimidi

Hi Team,

I have been implemented the code to remove Options from dropdownlist using the following code.

foo = "0 - Not applicable";
NWF$("#" + LossStatus + " option:contains(" + foo +")").remove();
foo = "1 - Loss not yet closed";
NWF$("#" + LossStatus + " option:contains(" + foo +")").remove();
foo = "2 - Loss closed";
NWF$("#" + LossStatus + " option:contains(" + foo +")").remove();

 

after that base on my condition i would like to add options to my dropdownlist with the following code.

NWF$('#' +LossStatus).append($('<option>', {value: 1,text: '1 - Loss not yet closed'}));

How ever its showing in dropdown. but could not able to save the form.

Showing error as "Some thing went wrong" and some correlation id.

 

Please help us to the correct way to add options to dropdown,

 

Regards,

Dhayanand

Outcomes