In 1 John 4:18, does "because fear hath punishment" mean, "He who fears will be punished"? attr() function: It sets or returns the attributes and values of the selected elements. In the above dropdown i know the text of the dropdown. Setting “checked” for a checkbox with jQuery. By using jQuery map functions we can set dropdownlist selected value based on value or text. jQuery provides text() method which returns text of any element. ... Then we are adding the text as option and text to our student dropdown list. Or, if there are similar values (thanks shanabus): contains is going to select the last match which might not be exact. To trigger the change event, you can call the .change() or .trigger("change") method after setting the value.. Alternatively, you can use the .prop() method to set the selectedIndex property which reflects the index of the selected