jQuery: Get the selected item from a dropdown in SharePoint

July 19th, 2013 | Posted by Marijn in Uncategorized

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.

You can follow any responses to this entry through the RSS 2.0 You can leave a response, or trackback.

Leave a Reply

%d bloggers like this: