SharePoint Stack Exchange is a question and answer site for SharePoint enthusiasts. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

Next to search box there is a dropdown containing query suggestions (everything, people, ...). How can I catch the value of this dropdown (it is div.s) in JavaScript (jQuery). Also I want to know which item has been chosen by the user in my JavaScript file.

share|improve this question

You can via javascript set an eventhandler on the dropdown list. You can set the eventhandler to trigger on .change() when it's a dropdownlists.

An example would be:

[In your masterpage]

$("DropDownListClientID").change(function () {
    GetSelectedSearch($(this + " option:selected"))

[In your .js file]

function GetSelectedSearch(selection)
    // your code here
share|improve this answer
thank you for your answer. In my js file I send query to search by uing Search Rest API and the result is shown in a div like a mega menu. I wanted to restrict the query by catching the value of this dropdownlist. the problem is this is not a realy dropdownlist but only divs. I am going to test your answer and will mark it as answer. – user12955 Feb 24 '13 at 17:02

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.