Site Search - give the input box focus

This is a forum to suggest new features for mojoPortal. 

This thread is closed to new posts. You must sign in to post in the forums.
8/12/2012 2:58:07 AM
Gravatar
Total Posts 533
feet planted firmly on the ground

Site Search - give the input box focus

The user currently has to click into the box before typing, which is unexpected these days for a google-like search facility. Could you give the input box the focus automatically please?

8/12/2012 3:46:13 PM
Gravatar
Total Posts 199
Community Expert

mojoPortal Hosting & Design @ i7MEDIA!

Re: Site Search - give the input box focus

Hi Crispin,

This seems more like a site-specific preference than a general feature request.

mojoPortal comes with the jQuery library included, so adding a small script to your site would be an easy way to achieve what you want.

Add this to the <head> of your layout.master, or in an external javascript sheet that is called in your layout.master.

$(document).ready(function() {
      $("mysearchelement").focus();
});

In this example, the text "mysearchelement" should be replaced with the class or ID of the input you want to have focus on page load - but leave the quotes there.

This link might help explain the jQuery function used: http://api.jquery.com/focus/

Hope this helps,
-Isaac

8/12/2012 5:54:25 PM
Gravatar
Total Posts 533
feet planted firmly on the ground

Re: Site Search - give the input box focus

Thanks Isaac for the joquery tip, though I do think this is a general request. For example, use the Search feature on http://demo.mojoportal.com and you'll find that after clicking "Search" and starting to type as one would on Google/Bing etc, you quickly arrive at that grrrrr moment.

This should be an easy general fix to SearchResults.aspx

8/13/2012 6:12:38 AM
Gravatar
Total Posts 18439

Re: Site Search - give the input box focus

I think Isaac is talking about the search input in layout.master which is on every page unless configured for link only and Crispin is talking about the /SearchResults.aspx page search input.

I will fix the Searchresults.aspx page so it focuses the search input by default. But I agree with Isaac that when the actual search box is shown on every page via layout.master it should not default to focused there, though if someone prefers that they can achieve it using the solution Isaac mentioned.

Best,

Joe

8/27/2012 1:53:57 PM
Gravatar
Total Posts 533
feet planted firmly on the ground

Re: Site Search - give the input box focus

Yes I can confirm I was talking about the /SearchResults.aspx page, rather than the search input in a header. So thanks for making the change.

 

You must sign in to post in the forums. This thread is closed to new posts.