I need to set by JavaScript a value to a dropdown field control knowing only Text.
For example, There is a dropdown control that has 3 values - One, Two, Three. I need to set my value to Three by JavaScript. I found that aricle Custom Script on O365 and according to this I can set value only knowing Id, but I want set value not by Id but by Text.
That works:
- NWF.FormFiller.Events.RegisterAfterReady(function () {
- NWF$('#' + ddlStaff).on('change', function (e) {
- if (e.originalEvent == undefined) {
- if (this.value == "") {
- this.value = "1";
- }
- }
- });
- });
But like this it does not work:
- NWF.FormFiller.Events.RegisterAfterReady(function () {
- NWF$('#' + ddlStaff).on('change', function (e) {
- if (e.originalEvent == undefined) {
- if (this.value == "") {
- this.value = "Three";
- }
- }
- });
- });
Any ideas how to set value by Text?