Importing or upgrading jQuery

Return to top
Have more questions? Submit a request

9 Comments

  • Sirin Sezer

    Hello

    Why V2 does not have jQuery library when published?

    0
  • Sirin Sezer

    We were using the codes from below article for V1

    Now we are in a way to create a new HC from scratch in V2 but below codes are not working

    any idea?

    https://support.zendesk.com/hc/en-us/articles/115002860148-Disabling-the-subject-and-description-fields-on-the-new-request-form-in-Help-Center-

    0
  • Erika Camille Sundian
    Zendesk Community Team

    Hello Sirin Sezer,

    Welcome to the Zendesk online Community!

    To be honest, It has been a while that jQuery was removed in the newer theme. If you really want to use jQuery, I would suggest you need to implement it as you would do on any other websites. Fortunately, you can use this through jQuery CDN: w3schools.com/jquery/jquery_get_started.asp

    Let me know if you have any questions! :)

    0
  • Sirin Sezer

    Hi Erika Camille Sundian

    It has been a while that jQuery was removed in the newer theme. How long ago this has been removed? and is it also affecting V1?

    Sirin

    0
  • Erika Camille Sundian
    Zendesk Community Team

    Hi there Sirin,

    jQuery was removed last February 24, 2020 and I don’t believe it is available in v1 anymore. 

    It sounds like you are trying to use jquery code, I would recommend you upgrade to the latest, supported v2 Templating, and import jquery as demonstrated in this article that we are currently on. 

    Hope this helps!

    0
  • Sam Donovan

    Sophie, this is great and saved us from an issue we were facing when transitioning from an older to a newer theme post-upgrade. Thank you! 

    --Sam

    0
  • gil alvarez

    I'm seeing a random/intermittent error with using jquery. I added the above to document_head.hbs, and then added some jquery code to script.js.

    And it works fine.....until it doesn't. The error in the console log: "$ is not defined" as if jquery wasn't loaded.

    The way I can repro, is to go to: https://.....zendesk.com/hc/en-us/requests/new

    And just keep hitting submit. Because of the required fields, it keeps erroring and the form redisplays. You can do this several times, no problem, everything is fine, and then maybe after 8 times I run into "$ is not defined". Very weird. I've seen this on Chrome and Safari, on both mac and windows.

    Any ideas?

    0
  • Augusto Silva
    Zendesk team member

    Hey gil alvarez,

    The easiest way to solve the problem you are seeing is to remove the keyword async from the line you copied.

    That will make sure that jquery is always loaded before you use it.

     

    Hope this helps

    0
  • gil alvarez

    Thanks Augusto, but why would the article say use async? Is it just a mistake?

    0

Please sign in to leave a comment.

Powered by Zendesk