I have created a node add form using the field group module to put the form in a jQuery accordion.

I have a auto-complete field that is at the bottom of one pane so the div that appears that lets users choose from the auto-complete options is behind the pane below it as it has overflow: hidden. Here is an image of the problem:

Image showing autocomplete behind pane below

I've fixed this behavior by changing 2 lines in autocomplete.js in the populatePopup function:

//var position = $input.position();
// changes to:
var position = $input.offset();

// and

// changes to: 

As the auto-complete div is now appended to the body it appears above everything else.

This is great but the problem is I don't want to start hacking Drupal core js files.

I could copy the whole autocomplete.js to a new file and then replace the whole thing, but really I just want to override the populatePopup function.

Is it possible to do this?

(I've tried copying the populatePopup function into my own js file but I get the error Drupal.jsAC is undefined.)

1 Answer 1


Doh - I was so close.

The answer is to simply copy the function you want to override to your own custom JS file but make sure to wrap it in a document ready function!

  • I think you should mark your own answer as accepted, that way it doesn't show as "unanswered" anymore ... Apr 10, 2017 at 7:56

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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