This topic is locked

Single line to go get displayed dropdown text in javascript

7/11/2026 13:32:53
PHPRunner Tips and Tricks
J
jMullally author

This is especially handy in validation messages.

Using the dropdown's 'ctrl' object, the following javascript returns the dropdown control's displayed text.

var dropdownText = ctrl.getDispElem().find("option:selected").text();