• Resolved rssail

    (@rssail)


    In my console I’m getting the following error:

    admin-bar.min.js:formatted:84 Uncaught TypeError: e.on is not a function
    at HTMLDocument.<anonymous> (admin-bar.min.js:formatted:84)
    at Object.resolveWith (jquery.min.js:16)
    at Function.ready (jquery.min.js:16)
    at HTMLDocument.B (jquery.min.js:16)
    (anonymous) @ admin-bar.min.js:formatted:84
    resolveWith @ jquery.min.js:16
    ready @ jquery.min.js:16
    B @ jquery.min.js:16

    In admin-bar.min.js the offending line is

    e.removeClass(“nojq”).removeClass(“nojs”),
    “ontouchstart”in window ? (e.on(“touchstart”, function() {

    • This topic was modified 6 years, 6 months ago by rssail.
    • This topic was modified 6 years, 6 months ago by rssail.
    • This topic was modified 6 years, 6 months ago by rssail.
Viewing 10 replies - 1 through 10 (of 10 total)
  • I do not receive this error on my installs.

    Where do you receive this error? Does it appear on every admin page?

    Have you disabled all the plugins and reverted to a default theme using the WordPress Healthcheck & Troubleshooting plugin? Documentation on Troubleshooting.

    What browser are you using?

    What OS are you running?

    Have you tried reinstalling WordPress via Dashboard -> Updates?

    We would need your help to narrow down the circumstances in which this error presents itself so it’s replicatable.

    Thread Starter rssail

    (@rssail)

    I’m using the latest version of chrome on a windows 10 64 bit desktop. The site is hosted at BlueHost. The page in question can be found here https://www.sustainablewestonma.org/campaigndetail/

    I’m really a newbe at wordpress. If I reinstall wordpress will I lose my site? If I remove plugins won’t the site stop working?

    If you use the WordPress Health Check & Troubleshooting plugin linked above, read the documentation, it’s a safe way to disable the plugins and revert to a default theme for only your user.

    To quote from the documentation:

    When utilizing the troubleshooting mode, your currently logged in user is given a stripped down version of WordPress, where all plugins are disabled and one of the default themes is activated.

    It is important to note that this is only the case for your user, it does not affect any other site visitors, or users of your site, for them the theme will be the same, and all plugins will still be running as before.

    This mode is essential when trying to identify the cause of an issue, as in most cases, any issue you have will be introduced by your theme or one of your plugins (or maybe even multiple plugins interacting poorly with each other).

    If you do not feel comfortable with doing so you may want to reach out to the BlueHost support team and see if they can solve this issue for you. Additionally, since it doesn’t sound like this is a site breaking issue, you could reachout to your local WordPress Meetup group or attend a local WordCamp and get assistance there.

    Thread Starter rssail

    (@rssail)

    The error only appears on that specific page. It’s a place where I’m using jquery. Here’s the code for the page:

    <link href="https://www.sustainablewestonma.org/wp-content/themes/twentytwelve-child/jquery/flexslider/css/myflexslider.css" rel="stylesheet" type="text/css">
    <link href="https://www.sustainablewestonma.org/wp-content/themes/twentytwelve-child/jquery/flexslider/flexslider.css" rel="stylesheet" type="text/css">
    <script src="https://ajax.googleapis.com/ajax/libs/jquery/1.6.2/jquery.min.js"></script>
    <script src="https://www.sustainablewestonma.org/wp-content/themes/twentytwelve-child/jquery/flexslider/jquery.flexslider.js"></script>
    <script src="https://www.sustainablewestonma.org/wp-content/themes/twentytwelve-child/jquery/flexslider/js/myFlexslider.js"></script>
    <div class="all-mobile">
      <h1>Mobile version under construction</h1>
    </div>
    <div class="det-container">
      <div class="det-topFlex">
        <div class="det-left flexslider">
          <ul class="slides">
            <li><img src="https://www.sustainablewestonma.org/wp-content/themes/twentytwelve-child/jquery/flexslider/demo/images/kitchen_adventurer_caramel4.jpg">
              <div class="det-sliderCaption">
                <div class="caption">Caption one.</div>
              </div>
            </li>
            <li><img src="https://www.sustainablewestonma.org/wp-content/themes/twentytwelve-child/jquery/flexslider/demo/images/kitchen_adventurer_donut.jpg">
              <div class="det-sliderCaption">
                <div class="caption">Caption two.</div>
              </div>
            </li>
            <li><img src="https://www.sustainablewestonma.org/wp-content/themes/twentytwelve-child/jquery/flexslider/demo/images/kitchen_adventurer_lemon.jpg">
              <div class="det-sliderCaption">
                <div class="caption">Caption three.</div>
              </div>
            </li>
          </ul>
        </div>
        <div class="det-right det-verticalFlex">
          <span><b>Get Involved</b></span>
          <div class="det-4links">
            <span><a href="https://sustainablewestonma.org/get-involved">Sign up for our<br class="wp">Quarterly Newsletter</a></span></div>
          <div class="det-4links"> <span><a href="https://www.sustainablewestonma.org/calendar/">Attend an<br class="wp">
                Event</a></span></div>
          <div class="det-4links"> <span><a href="https://sustainablewestonma.org/get-involved">Volunteer with<br class="wp">SWAG</a></span></div>
          <div class="det-4links"> <span><a href="https://www.sustainablewestonma.org/donate/">Donate to help<br class="wp">our work</a></span></div>
        </div>
      </div>
    </div>

    and here’s the css

    
    .flex-control-nav.flex-control-paging{
       display:none;
    }
    
    ul.flex-direction-nav{
       list-style:none;
       margin:0;
    }
    .det-sliderCaption{
       display:flex;
       justify-content:center;
    }
    
    .flexslider{
       margin:0!important;
       border:none!important;
    }
    
    .slides{
       margin:0!important;
    }
    
    .caption{
       position:absolute;
       bottom:1vw;
       color:white;
    }
    
    .det-container{
       margin-top:2vw;
    }
    
    .det-topFlex{
       display:flex;
       justify-content:space-between;     
    }
    
    .det-topFlex .det-left{ 
       width:64%;  
    }
    
    .det-topFlex .det-right{
       width:37%;
       margin-left:2%;  
       padding-bottom:3vw;
       background-color:#b3d7f7;  
    }
    
    .det-topFlex .det-top img{
       width:100%;
       height:100%;  
    }
    
    .det-verticalFlex{
       display:flex;
       flex-direction:column;
       align-items:center;
       justify-content:space-between;  
       background-color:#b3d7f7;   
    }
    
    .det-topFlex .det-right span{
       text-align:center;
       font-size:2vw;  
       color:#538231;   
       margin:1.6vw 0;
    }  
    
    .det-4links span{
       display:block;
       color:white;
       background-color:#538231;
       width:17vw;
       font-size:1.5vw!important;
       text-align:center;
       border-radius:3vw;     
    }
    
    .det-4links a{
       text-decoration:none;
       color:white;
    }
    .det-4links a:visited{
       color:white;
    }
    
    

    Don’t call your own jQuery. It’s likely overwriting the already loaded jQuery and thus creating an error. What happens if you remove the jQuery embed script entirely?

    Remove this line:

    <script src="https://ajax.googleapis.com/ajax/libs/jquery/1.6.2/jquery.min.js"></script>

    Thread Starter rssail

    (@rssail)

    I tried the healthcheck plugin and it says everything is running smoothly. By the way, your suggestion to ask a host provider for help is pretty comical.

    This is a wordpress issue coming from using jquery and linking to resources inside the body tag. While not recommended linking within the body should not create the problem.

    If you use the code supplied and set up a new page with it you should be able to reproduce the error. Can you help?

    Try my suggestion in the previous post. By default, WordPress uses an older version of jQuery. If you are overwriting the pre-existing jQuery by implementing your own 1.6.2 jQuery then you may run into issues.

    If you find that you need this version of jQuery for flexslider to work properly then you’ll need to contact a local developer to help implement this properly. Otherwise, you can try to install and use one of the pre-existing WordPress slider plugins such as WP Flexslider.

    Thread Starter rssail

    (@rssail)

    removing the jquery load fixed the problem but created another one. I’m calling myFlexslider.js which has the following function:

    
    $(window).load(function() {
              $('.flexslider').flexslider({
                 animation: "fade",
                 easing: "swing",  
                 direction: "horizontal",  //String: Select the sliding direction, "horizontal" or "vertical"
                 reverse: false,
                 animationLoop: true,  
                 slideshow: true,  //Boolean: Animate slider automatically
                 slideshowSpeed: 10000,  //Integer: Set the speed of the slideshow cycling, in milliseconds
                 animationSpeed: 2000, //Integer: Set the speed of animations, in milliseconds
                 initDelay: 0, //{NEW} Integer: Set an initialization delay, in milliseconds
                 randomize: false, //Boolean: Randomize slide order
              });
           });
    

    The console says $ is not a function. I changed that to jquery and it says jquery not defined

    Javascript is very finicky and case sensitive. Try this:

    ( function( $ ) {
    	$(window).load(function() {
    		$('.flexslider').flexslider({
    			animation: "fade",
    			easing: "swing",  
    			direction: "horizontal",  //String: Select the sliding direction, "horizontal" or "vertical"
    			reverse: false,
    			animationLoop: true,  
    			slideshow: true,  //Boolean: Animate slider automatically
    			slideshowSpeed: 10000,  //Integer: Set the speed of the slideshow cycling, in milliseconds
    			animationSpeed: 2000, //Integer: Set the speed of animations, in milliseconds
    			initDelay: 0, //{NEW} Integer: Set an initialization delay, in milliseconds
    			randomize: false, //Boolean: Randomize slide order
    		});
       });
    } )( jQuery );
    Thread Starter rssail

    (@rssail)

    added

    
    jQuery(document).ready(function($) {
    
    

    and that fixed the last problem. Thank you for your help!

    • This reply was modified 6 years, 6 months ago by rssail.
Viewing 10 replies - 1 through 10 (of 10 total)

The topic ‘wordpress creating js error unable to find function’ is closed to new replies.