After much trouble, I have finally found a script tag in PersonalViews.aspx that was inserted by previous admin some time ago. This script tag references some javascript that is breaking when it reaches $. The error is '$ is undefined'

if ($("th").find(".ms-vh-div[name='ID']").parent("th").index() >= 0)

I do not know how to resolve this issue. Please advise? Thanks in advance.


Can you verify the jQuery file loading to the browser. Here are the steps

  • Open a page in browser (Steps below I am referring to Firefox)
  • Open Developer tool (F12)
  • Click on network tab and filter JS files by clicking "JS"
  • See you can find jQuery library file. It should be loaded inorder work jQuery

There will be conflict sometimes because multiple versions of jQuery files.

if ($("th").find(".ms-vh-div[name='ID']").parent("th").index() >= 0)

executes code when a View Column ID exists

and can be done without jQuery:

if( GetAncestor(document.querySelector("[name='ID']"),'TH') )

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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