Take the 2-minute tour ×
SharePoint Stack Exchange is a question and answer site for SharePoint enthusiasts. It's 100% free, no registration required.

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. thanks for your advice.

share|improve this question

1 Answer 1

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

 
discard

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.