jQuery issue on design mode in Kentico 8

giang le asked on October 27, 2014 11:30

Hi All,

After I upgrade Kentico from 7 to 8, we got 1 issue with jQuery. In Kentico 7, I used the code below to register jQuery an it work well in Live Site mode and design mode (CMSDesk):

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

var $ = jQuery.noConflict();

I didn't change this code when I upgrade to Kentico 8. However, it only work when I don't access to Design mode (Home -> Page).

For example:

I open Admin page(Home->Page) on tab 1

I open Live Site on tab 2

The jQuery is not working (we got error "$ is not a function" from browser). However, if I close the tab 1 then reload tab 2 or open Live Site on other browser, jQuery worked as normally.

Please help me to resolve it.

Recent Answers


Roman Mazur answered on October 28, 2014 15:51 (last edited on October 28, 2014 15:53)

Hello Giang,

I have written an article regarding your issue and best practices about how to use jQuery when developing sites in Kentico. Please, read it here and feel free to add your feedback under the article.

Hope this helps with your issue. We try to do our best to address issues with live site javascript libraries and fix them in order to simplify sites development in Kentico for you.

1 votesVote for this answer Mark as a Correct answer

giang le answered on October 31, 2014 05:06

Thank for your reply, Roman!

I read your article and I tried to apply on my site:

  • I uncomment my code

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

    then embed the jquery link on master page. However, it still not work.

  • I also search var $cmsj = jQuery.noConflict(); to replace by var $cmsj = jQuery.noConflict(true);, but I cannot search it in jquery-core.js file.

    Do you know what occurred with my site? Please suggest for me a best solution?

0 votesVote for this answer Mark as a Correct answer

giang le answered on November 6, 2014 10:54

Hi all, please help me! I still could not resolve this problem!!!!!!!

0 votesVote for this answer Mark as a Correct answer

Roman Mazur answered on November 14, 2014 13:34 (last edited on November 14, 2014 13:36)

Hello Giang, as is written in the article, it can be done only on Kentico 8.1 and further. Sorry I didn't mention it in my reply from October 28.

You will need to upgrade your site to Kentico 8.1, which I highly recommend to you because of the fixes in compatibility with jQuery.

0 votesVote for this answer Mark as a Correct answer

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