jQuery: Get the selected item from a dropdown in SharePoint

Another small jQuery post about getting the selected item from a dropdown in SharePoint. This time we are looking at the famous dropdowns in SharePoint. I already posted an article on how to hide dropdown values here.

Get the selected item from a dropdown

var sText = $("select[title='field name'] option:selected").text();

When you are working with a choice field, both .text() and .val() will get you the text of the option.

When you are working with a lookup field, .text() will get you the text in the option and .val() will get you the ID of the item.

About: Marijn

Marijn Somers (MVP) has over 14 years experience in the SharePoint world, starting out with SP2007. Over the years the focus has grown to Office 365, with a focus on collaboration and document management. He is a business consultant at Balestra and Principal Content Provider for "Mijn 365 Coach" that offers dutch employee video training. His main work tracks are around user adoption, training and coaching and governance. He is also not afraid to dig deeper in the technicalities with PowerShell, adaptive cards or custom formatting in lists and libraries. You can listen to him on the biweekly "Office 365 Distilled" podcast.

%d bloggers like this: