<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Re: Conflicting jQuery Issue in APIs &amp; Integrations</title>
    <link>https://community.hubspot.com/t5/APIs-Integrations/Conflicting-jQuery-Issue/m-p/239812#M18708</link>
    <description>&lt;P&gt;Looks like the error is Uncaught TypeError: $ is not a function&lt;BR /&gt;
at lopage:893 at the accordion element. Try wrapping the jquery in a self invoking function and moving everything into one script tag.&lt;/P&gt;
&lt;PRE&gt;&lt;CODE&gt;$(function() { 
 })();&lt;/CODE&gt;&lt;/PRE&gt;</description>
    <pubDate>Thu, 15 Feb 2018 20:03:05 GMT</pubDate>
    <dc:creator />
    <dc:date>2018-02-15T20:03:05Z</dc:date>
    <item>
      <title>Conflicting jQuery Issue</title>
      <link>https://community.hubspot.com/t5/APIs-Integrations/Conflicting-jQuery-Issue/m-p/239811#M18707</link>
      <description>&lt;P&gt;I’m trying to run 2 jQuery scripts on 1 page and am not sure how to do it. I have both scripts running in a HubL code module in a global footer. One is for the Mobile Menu, the other is for an accordion. I put the accordion module on this page: &lt;A href="http://www-apexhomeloans-com.sandbox.hs-sites.com/lopage" rel="nofollow noopener"&gt;http://www-apexhomeloans-com.sandbox.hs-sites.com/lopage&lt;/A&gt;&lt;/P&gt;
&lt;P&gt;jQuery code in the HubL template is below. Both scripts run individually, but the accordion script doesn’t run if the mobile menu script is there.&lt;/P&gt;</description>
      <pubDate>Thu, 15 Feb 2018 17:24:03 GMT</pubDate>
      <guid>https://community.hubspot.com/t5/APIs-Integrations/Conflicting-jQuery-Issue/m-p/239811#M18707</guid>
      <dc:creator>apex</dc:creator>
      <dc:date>2018-02-15T17:24:03Z</dc:date>
    </item>
    <item>
      <title>Re: Conflicting jQuery Issue</title>
      <link>https://community.hubspot.com/t5/APIs-Integrations/Conflicting-jQuery-Issue/m-p/239812#M18708</link>
      <description>&lt;P&gt;Looks like the error is Uncaught TypeError: $ is not a function&lt;BR /&gt;
at lopage:893 at the accordion element. Try wrapping the jquery in a self invoking function and moving everything into one script tag.&lt;/P&gt;
&lt;PRE&gt;&lt;CODE&gt;$(function() { 
 })();&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Thu, 15 Feb 2018 20:03:05 GMT</pubDate>
      <guid>https://community.hubspot.com/t5/APIs-Integrations/Conflicting-jQuery-Issue/m-p/239812#M18708</guid>
      <dc:creator />
      <dc:date>2018-02-15T20:03:05Z</dc:date>
    </item>
    <item>
      <title>Re: Conflicting jQuery Issue</title>
      <link>https://community.hubspot.com/t5/APIs-Integrations/Conflicting-jQuery-Issue/m-p/239813#M18709</link>
      <description>&lt;P&gt;&lt;A class="mention" href="https://community.hubspot.com/u/fly.space.age"&gt;@fly.space.age&lt;/A&gt;&lt;/P&gt;
&lt;P&gt;Thanks. I meant to include the actual code, but I think I left html tags around it so it didn’t show up lol. It is exactly what you’re saying, but I’m not sure how to fix it. I’m just using code that I found online for each section and don’t really know jQuery, unfortunately.&lt;/P&gt;
&lt;P&gt;MOBILE MENU CODE&lt;/P&gt;
&lt;P&gt;var $mobile = jQuery.noConflict();&lt;BR /&gt;
$mobile(function() {&lt;/P&gt;
&lt;PRE&gt;&lt;CODE&gt;/** 
 * Mobile Nav
 *
 * Hubspot Standard Toggle Menu
 */
$mobile('.custom-menu-primary').addClass('js-enabled');
$mobile('.custom-menu-primary .hs-menu-flow-horizontal').before('&amp;lt;a class="mobile-trigger"&amp;gt;&amp;lt;span&amp;gt;&amp;lt;/span&amp;gt;&amp;lt;i&amp;gt;&amp;lt;/i&amp;gt;&amp;lt;/a&amp;gt;');
$mobile('.custom-menu-primary .flyouts .hs-item-has-children &amp;gt; a').after('&amp;lt;a class="child-trigger"&amp;gt;&amp;lt;span&amp;gt;&amp;lt;/span&amp;gt;&amp;lt;/a&amp;gt;');
$mobile('a.mobile-trigger').click(function() {
    $mobile(this).next('.custom-menu-primary .hs-menu-flow-horizontal').slideToggle(250);
    $mobile('body').toggleClass('mobile-open');
    $mobile('a.child-trigger').removeClass('child-open');
    $mobile('.hs-menu-children-wrapper').slideUp(250);
    return false;
 });

$mobile('a.child-trigger').click(function() {
    $mobile(this).parent().siblings('.hs-item-has-children').find('a.child-trigger').removeClass('child-open');
    $mobile(this).parent().siblings('.hs-item-has-children').find('.hs-menu-children-wrapper').slideUp(250);
    $mobile(this).next('.hs-menu-children-wrapper').slideToggle(250);
    $mobile(this).next('.hs-menu-children-wrapper').children('.hs-item-has-children').find('.hs-menu-children-wrapper').slideUp(250);
    $mobile(this).next('.hs-menu-children-wrapper').children('.hs-item-has-children').find('a.child-trigger').removeClass('child-open');
    $mobile(this).toggleClass('child-open');
    return false;
});
&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;});&lt;/P&gt;
&lt;P&gt;ACCORDION CODE&lt;/P&gt;
&lt;P&gt;var $accordion = $(’.accordion’);&lt;/P&gt;
&lt;P&gt;// Initially hide all accordion content&lt;BR /&gt;
$accordion.find(’.accordion_content’).hide();&lt;BR /&gt;
// Initially display the accordion content with .expanded class&lt;BR /&gt;
$accordion.find(’.accordion_group.expanded .accordion_content’).show();&lt;/P&gt;
&lt;P&gt;$accordion.find(’.accordion_header’).click(function(){&lt;/P&gt;
&lt;PRE&gt;&lt;CODE&gt;// Hide the displayed sibling accordion content so only one appears at a time
&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;$accordion.find(".accordion_header").not(this).parent(".accordion_group.expanded").removeClass(‘expanded’).children(’.accordion_content’).stop(true,true).slideUp();&lt;/P&gt;
&lt;PRE&gt;&lt;CODE&gt;if(!$(this).parent('.accordion_group').hasClass('expanded')){
    // Display the accordion content if it is not displayed
    $(this).parent(".accordion_group").addClass('expanded').children('.accordion_content').stop(true,true).slideDown();
}
else{
    // Hide the accordion content if it is displayed
    $(this).parent(".accordion_group").removeClass('expanded').children('.accordion_content').stop(true,true).slideUp();
}
&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;});&lt;/P&gt;</description>
      <pubDate>Thu, 15 Feb 2018 21:21:52 GMT</pubDate>
      <guid>https://community.hubspot.com/t5/APIs-Integrations/Conflicting-jQuery-Issue/m-p/239813#M18709</guid>
      <dc:creator>apex</dc:creator>
      <dc:date>2018-02-15T21:21:52Z</dc:date>
    </item>
    <item>
      <title>Re: Conflicting jQuery Issue</title>
      <link>https://community.hubspot.com/t5/APIs-Integrations/Conflicting-jQuery-Issue/m-p/239814#M18710</link>
      <description>&lt;PRE&gt;&lt;CODE&gt;$(document).ready(function(){

var $mobile = jQuery.noConflict();
$mobile(function() {
    /** 
     * Mobile Nav
     *
     * Hubspot Standard Toggle Menu
     */
    $mobile('.custom-menu-primary').addClass('js-enabled');
    $mobile('.custom-menu-primary .hs-menu-flow-horizontal').before('&amp;lt;a class="mobile-trigger"&amp;gt;&amp;lt;span&amp;gt;&amp;lt;/span&amp;gt;&amp;lt;i&amp;gt;&amp;lt;/i&amp;gt;&amp;lt;/a&amp;gt;');
    $mobile('.custom-menu-primary .flyouts .hs-item-has-children &amp;gt; a').after('&amp;lt;a class="child-trigger"&amp;gt;&amp;lt;span&amp;gt;&amp;lt;/span&amp;gt;&amp;lt;/a&amp;gt;');
    $mobile('a.mobile-trigger').click(function() {
        $mobile(this).next('.custom-menu-primary .hs-menu-flow-horizontal').slideToggle(250);
        $mobile('body').toggleClass('mobile-open');
        $mobile('a.child-trigger').removeClass('child-open');
        $mobile('.hs-menu-children-wrapper').slideUp(250);
        return false;
     });

    $mobile('a.child-trigger').click(function() {
        $mobile(this).parent().siblings('.hs-item-has-children').find('a.child-trigger').removeClass('child-open');
        $mobile(this).parent().siblings('.hs-item-has-children').find('.hs-menu-children-wrapper').slideUp(250);
        $mobile(this).next('.hs-menu-children-wrapper').slideToggle(250);
        $mobile(this).next('.hs-menu-children-wrapper').children('.hs-item-has-children').find('.hs-menu-children-wrapper').slideUp(250);
        $mobile(this).next('.hs-menu-children-wrapper').children('.hs-item-has-children').find('a.child-trigger').removeClass('child-open');
        $mobile(this).toggleClass('child-open');
        return false;
    });
});

/** 
 * jQuery Accordion
 *
 * 
 */
var $accordion = $('.accordion');

// Initially hide all accordion content
$accordion.find('.accordion_content').hide();
// Initially display the accordion content with .expanded class
$accordion.find('.accordion_group.expanded .accordion_content').show();

$accordion.find('.accordion_header').click(function(){

    // Hide the displayed sibling accordion content so only one appears at a time
    $accordion.find(".accordion_header").not(this).parent(".accordion_group.expanded").removeClass('expanded').children('.accordion_content').stop(true,true).slideUp();

    if(!$(this).parent('.accordion_group').hasClass('expanded')){
        // Display the accordion content if it is not displayed
        $(this).parent(".accordion_group").addClass('expanded').children('.accordion_content').stop(true,true).slideDown();
    }
    else{
        // Hide the accordion content if it is displayed
        $(this).parent(".accordion_group")
.removeClass('expanded').children('.accordion_content').stop(true,true).slideUp();
    }
});

})(jQuery);&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Thu, 15 Feb 2018 21:27:30 GMT</pubDate>
      <guid>https://community.hubspot.com/t5/APIs-Integrations/Conflicting-jQuery-Issue/m-p/239814#M18710</guid>
      <dc:creator />
      <dc:date>2018-02-15T21:27:30Z</dc:date>
    </item>
    <item>
      <title>Re: Conflicting jQuery Issue</title>
      <link>https://community.hubspot.com/t5/APIs-Integrations/Conflicting-jQuery-Issue/m-p/239815#M18711</link>
      <description>&lt;P&gt;&lt;A class="mention" href="https://community.hubspot.com/u/fly.space.age"&gt;@fly.space.age&lt;/A&gt; Hmm. Should that work as is? Seems both aren’t working if I put it in that way. Thanks for your help! I at least know the issue, just have to figure out how to combine the two functions into 1 script now.&lt;/P&gt;
&lt;P&gt;&lt;A href="http://www-apexhomeloans-com.sandbox.hs-sites.com/lopage" class="onebox" target="_blank" rel="nofollow noopener"&gt;http://www-apexhomeloans-com.sandbox.hs-sites.com/lopage&lt;/A&gt;&lt;/P&gt;</description>
      <pubDate>Thu, 15 Feb 2018 21:59:40 GMT</pubDate>
      <guid>https://community.hubspot.com/t5/APIs-Integrations/Conflicting-jQuery-Issue/m-p/239815#M18711</guid>
      <dc:creator>apex</dc:creator>
      <dc:date>2018-02-15T21:59:40Z</dc:date>
    </item>
    <item>
      <title>Re: Conflicting jQuery Issue</title>
      <link>https://community.hubspot.com/t5/APIs-Integrations/Conflicting-jQuery-Issue/m-p/239816#M18712</link>
      <description>&lt;P&gt;Try adding the self-invoking function around the document.ready.  I think the problem is that the browser doesn’t know to look for the jQuery library.&lt;/P&gt;
&lt;PRE&gt;&lt;CODE&gt;(function ($) {
    $(document).ready(function() {

    });
 })(jQuery);
&lt;/CODE&gt;&lt;/PRE&gt;
&lt;ASIDE class="onebox stackexchange"&gt;
  &lt;HEADER class="source"&gt;
      &lt;A href="https://stackoverflow.com/questions/33056230/uncaught-typeerror-ready-is-not-a-function" target="_blank" rel="nofollow noopener"&gt;stackoverflow.com&lt;/A&gt;
  &lt;/HEADER&gt;
  &lt;ARTICLE class="onebox-body"&gt;
      &lt;A href="https://stackoverflow.com/users/5419041/nick-m" target="_blank" rel="nofollow noopener"&gt;
    &lt;IMG alt="Nick M" src="https://community.hubspot.com/legacyfs/online/uploads/default/original/2X/f/f2ba28a5092e1b5f3a496cf6017857564da8d7fd.png" class="thumbnail onebox-avatar" width="128" height="128" /&gt;
  &lt;/A&gt;
&lt;H4&gt;
  &lt;A href="https://stackoverflow.com/questions/33056230/uncaught-typeerror-ready-is-not-a-function" target="_blank" rel="nofollow noopener"&gt;Uncaught TypeError: $(...).ready is not a function&lt;/A&gt;
&lt;/H4&gt;

&lt;DIV class="tags"&gt;
  &lt;STRONG&gt;jquery&lt;/STRONG&gt;
&lt;/DIV&gt;

&lt;DIV class="date"&gt;
  
  
  &lt;A href="https://stackoverflow.com/users/5419041/nick-m" target="_blank" rel="nofollow noopener"&gt;
    Nick M
  &lt;/A&gt;
  on &lt;A href="https://stackoverflow.com/questions/33056230/uncaught-typeerror-ready-is-not-a-function" target="_blank" rel="nofollow noopener"&gt;04:29PM - 10 Oct 15&lt;/A&gt;
&lt;/DIV&gt;

  &lt;/ARTICLE&gt;
  &lt;DIV class="onebox-metadata"&gt;
    
    
  &lt;/DIV&gt;
  &lt;DIV style="clear: both"&gt;&lt;/DIV&gt;
&lt;/ASIDE&gt;</description>
      <pubDate>Thu, 15 Feb 2018 22:04:04 GMT</pubDate>
      <guid>https://community.hubspot.com/t5/APIs-Integrations/Conflicting-jQuery-Issue/m-p/239816#M18712</guid>
      <dc:creator />
      <dc:date>2018-02-15T22:04:04Z</dc:date>
    </item>
    <item>
      <title>Re: Conflicting jQuery Issue</title>
      <link>https://community.hubspot.com/t5/APIs-Integrations/Conflicting-jQuery-Issue/m-p/239817#M18713</link>
      <description>&lt;P&gt;Thanks, bud! Works now. I just ended up switching every “$” to “jQuery” like they said in that SO post. Definitely have to start learning javascript and jQuery - I’m more on the marketing end and do PPC campaigns and stuff like that, but I do want to learn more development. Thanks again!&lt;/P&gt;</description>
      <pubDate>Fri, 16 Feb 2018 00:53:42 GMT</pubDate>
      <guid>https://community.hubspot.com/t5/APIs-Integrations/Conflicting-jQuery-Issue/m-p/239817#M18713</guid>
      <dc:creator>apex</dc:creator>
      <dc:date>2018-02-16T00:53:42Z</dc:date>
    </item>
  </channel>
</rss>

