SharePoint quick search does not trigger / work in Chrome

I ran into a problem with Chrome last week. The problem is as following:

When you type a search term in the SharePoint Quick Search Box and press enter this should cause a search to be performed. This works great on Internet Explorer and FireFox BUT on Chrome this does not work. The problem in Chrome is that you have to press the enter key TWICE before a search if performed.

Well as usual with SP and weird problems I could not find a reasonable solution related to SP and since this was a Chrome problem I decided to do the “normal” and go around the problem.

How to do it?

Findthe input text box using JQuery and “force” an enter key press in that box. This for some reason “re-activates” the key pressing event of the text box  In my tests to see what is wrong with the text box in the SP quick search I found that in Chrome no key pressing events launched. The forcing of enter reinstates the key pressing events to the text box.

Here is the JQuery that will fix your problem. Replace the JQuery search terms to your search box for this to work:

// To fix Chrome enter pressing when trying to search something the first enter does not work
$j(‘input[name*=”InputKeywords”]’).focus(function () {
// This will refocus the text box and the key press event will fire normally
$j(this).trigger({
type: ‘keypress’,
which: 13
});
});

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s