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:
But like this it does not work:
Any ideas how to set value by Text?
Solved! Go to Solution.
I have found the solution:
NWF$("#" + ddlStaff + " option:contains(" + Three +")").attr("selected", true);