$ is not a function jQuery error after upgrade from 7 to 8.0

Jaroslav Šebok asked on August 23, 2016 15:09

So I've upgraded from 7 to 8.0 and I got this error in a custom web part:

`Uncaught TypeError: $ is not a function`

on the line

`var $=jQuery.noConflict();$(function(){$(".footable").footable()})`

stacktrace looks like this:

(anonymous function)    @GetResource.ashx?scriptfile=%2fCMSScripts%2fCustom%2fCSOBL%2fstartFoo.js:1
v   @GetResource.ashx?scriptfile=~%2fCMSScripts%2fjquery%2fjquery-core.js:16
fireWith    @GetResource.ashx?scriptfile=~%2fCMSScripts%2fjquery%2fjquery-core.js:16
ready   @GetResource.ashx?scriptfile=~%2fCMSScripts%2fjquery%2fjquery-core.js:16
u   @GetResource.ashx?scriptfile=~%2fCMSScripts%2fjquery%2fjquery-core.js:16

Can you recommend any solution to this?

I already tried

ScriptHelper.RegisterJQuery(Page);
ScriptHelper.RegisterJQueryUI(Page);
ScriptHelper.RegisterJQueryDialog(Page);

or

`ScriptHelper.RegisterJQuery(Page);`

Recent Answers


Trevor Fayas answered on August 23, 2016 15:26

Upgrade to 8.2, 8.1 the option to use your own jQuery became available, 8.2 the option is forced, so if you go to 8.2 you'll be able to use your own jQuery without conflict and needing to do the no conflict tricks. anything before 8.1 the CMS uses the $ so it may cause issues.

2 votesVote for this answer Mark as a Correct answer

Brenden Kehren answered on August 23, 2016 16:29

Agree with Trevor, if you're already on 8.0.x, then you might as well upgrade to 8.2.49.

1 votesVote for this answer Mark as a Correct answer

   Please, sign in to be able to submit a new answer.