Skip to:

Set input focus jQuery script only works when logged in. Why?!

  • peterverkooijen


    I use this bit of jQuery to set focus to the first input fields in forms:

    jQuery(document).ready(function() {
    // focus on the first text input field in the first field on the page
    jQuery("input[type='text']:not(.nofocus):visible:enabled:first", document.forms[0]).focus();

    It works great, but only when I’m logged-in. Why?!

    Has anyone seen something similar? Is there javascript that’s only loaded when you’re not logged-in that could cause a conflict? How can I troubleshoot this?

    How does logging-in affect jQuery/javascript?

    Is there a way to make the jQuery more conflict-proof?

Viewing 2 replies - 1 through 2 (of 2 total)

  • John James Jacoby


    When you’re not logged in, in a normal BP website the first input of the type text that is on the page is the search box for members/groups/blogs.

    I would use firefox/firebug/yslow to see which scripts are loading and if there are any other errors on the page causing it to stop?

    On a basic installation, logging in/out won’t break jQuery in any way.



    Search boxes are excluded with .nofocus. I’d like the set-focus script to work on the signup form, contact form and event forms (plugins).

    When not logged in the page loads fine, the focus just does not get set. Logging out doesn’t break jQuery. There are no problems with other jQuery dependant scripts.

    As far as I can tell all the necessary scripts are loaded. I guess the set-focus script conflicts with something that’s only active when not logged in. What could that be?

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘Set input focus jQuery script only works when logged in. Why?!’ is closed to new replies.
Skip to toolbar