相关疑难解决方法(0)

未捕获的ReferenceError:未定义jQuery

我在我的网站上实现了一些JavaScript,但我不断收到以下错误消息:

未捕获的ReferenceError:未定义jQuery

未捕获的SyntaxError:意外的令牌<

这是我在header.php中使用的JavaScript:

    <script type="text/javascript" src="/test/wp-content/themes/child/script/jquery.jcarousel.min.js"></script>
    <script type="text/javascript" src="/test/wp-content/themes/child/script/jquery.scrollTo.js"></script>
    <script type="text/javascript" src="/test/wp-content/themes/child/script/jquery.backgroundPosition.js"></script>
    <script type="text/javascript" src="/test/wp-content/themes/child/script/scripts.js"></script>
    <script type="text/javascript" src="/test/wp-content/themes/child/script/jquery.cycle.lite.js"></script>
    <script type="text/javascript" src="/test/wp-content/themes/child/script/jquery.accordian.js"></script>

    <script type="text/javascript">
        jQuery(document).ready(function () {
            jQuery('#contentGallery').cycle({
                fx: 'fade' // choose your transition type, ex: fade, scrollUp, shuffle, etc...
            });
        });
    </script>
</head>

<body <?php body_class(); ?>>
<div id="page" class="hfeed">
    <header id="branding" role="banner">
            <hgroup>
                <h1 id="site-title"><span><a href="<?php echo esc_url( home_url( '/' ) ); ?>" title="<?php echo esc_attr( get_bloginfo( 'name', 'display' ) ); ?>" rel="home"><?php bloginfo( 'name' ); ?></a></span></h1> …
Run Code Online (Sandbox Code Playgroud)

javascript jquery

108
推荐指数
4
解决办法
52万
查看次数

ReferenceError:$未定义

我有这个错误消息ReferenceError: $ is not defined
这是我的标题.

<link href="css/global-style.css" rel="stylesheet" type="text/css" media="screen">
<link rel="stylesheet" type="text/css" media="screen" href="css/datepicker3.css">
<script type="text/javascript" src="js/jquery.js"></script>
<script type="text/javascript" src="assets/bootstrap/js/bootstrap.min.js"></script>
<script type="text/javascript" src="js/bootstrap-datepicker.js"></script>
Run Code Online (Sandbox Code Playgroud)

以下是我的JavaScript代码

<script type="text/javascript">
$('#sandbox-container .input-daterange').datepicker({
    startDate: "today",
    calendarWeeks: true,
    todayHighlight: true
});
</script>
Run Code Online (Sandbox Code Playgroud)

以下是HTML

<div class="col-md-12" id="sandbox-container">
    <label>Project Duration</label>
    <div class="input-daterange input-group" id="datepicker">
            <input type="text" class="input-md form-control" name="start" />
            <span class="input-group-addon">to</span>
            <input type="text" class="input-md form-control" name="end" />
    </div>
</div>
Run Code Online (Sandbox Code Playgroud)

我想在输入标签上显示datepicker.
我正在使用Bootstrap V3.1.
我正在使用这个日期选择器

html javascript jquery

50
推荐指数
4
解决办法
32万
查看次数

HTTPS和外部(CDN)托管文件?

我有一个页面引用了几个外部托管的javascript文件 - 即Google上的jQuery使用YUI Loader的YUI.

问题是当我通过HTTPS访问页面时,浏览器会抱怨混合不安全的内容,因为外部javascript文件是使用http而不是https访问的.

处理这个问题的好方法是什么,用HTTPS访问外部jQuery和YUI Loader对象?

jquery yui cdn

30
推荐指数
2
解决办法
2万
查看次数

未捕获的ReferenceError:当jquery.js位于文档末尾时,未定义$

我有一个项目,其中所有的JS文件都在页脚中引用,建议用于页面加载的速度,包括指向Jquery文件的链接.这段代码产生一个"Uncaught ReferenceError",我假设因为在调用脚本之前尚未定义Jquery:

<html>
    <head>
        <link rel="stylesheet" type="text/css" href="css/bootstrap.css">
    </head>
    <body>
        <p>
            <a href="#" data-toggle="popover" title="first popover" id="example">hover over me</a>
        </p>
        <script type="text/javascript"> 
            $(function(){
                $('#example').popover({ trigger:'hover' });
            })
        </script>

        <script type="text/javascript" src="js/jquery.min.js"></script>
        <script type="text/javascript" src="js/bootstrap.js"></script>
    </body>
</html>
Run Code Online (Sandbox Code Playgroud)

如果我将Jquery链接移动到标题,那么代码运行正常,但这将减慢页面加载时间.

是否有更好的方法来声明我的函数,以便它不会抛出此UncaughtReference错误,或者保持头部中的Jquery链接是最佳解决方案?

html jquery dom

18
推荐指数
3
解决办法
4万
查看次数

JavaScript Uncaught ReferenceError:未定义jQuery; 未捕获的ReferenceError:$未定义

这是我的小提琴,http://jsfiddle.net/4vaxE/35/

它在我的小提琴中运作良好.

但是,当我将它转移到Dreamweaver时,它无法工作.我在编码中发现了这两个错误.

  1. 未捕获的ReferenceError:未定义jQuery
  2. 未定义的referenceerror $未定义

我之前读过有关这两个错误的文章,并尝试按照提供的方法解决,但是,它仍然无法正常工作,我该如何解决?

这是我在Dreamweaver中的完整编码

<body>
    <div class="buttons" style="background-color: rgba(0,0,0,.8);">
    <a class="button" id="showdiv1">Div 1</a>
    <a class="button" id="showdiv2">Div 2</a>
    <a class="button" id="showdiv3">Div 3</a>
    <a class="button" id="showdiv4">Div 4</a>
    </div>

    <div id="div1">1</div>
    <div id="div2">2</div>
    <div id="div3">3</div>
    <div id="div4">4</div>
</div>
<script language="JavaScript" type="text/javascript" script src="http://ajax.googleapis.com/ajax/libs/jqueryui/1.10.0/jquery-ui.min.js"></script>

<script language="JavaScript" type="text/javascript">
var selectedEffect="explode";
var options = { percent: 100 };
$('#showdiv1').click(function () {
    $('div[id^=div]').hide();

    $('#div1').show( selectedEffect, options, 500, callback );
});
$('#showdiv2').click(function () {
    $('div[id^=div]').hide();
    $('#div2').show( selectedEffect, options, 500, callback );
});

$('#showdiv3').click(function …
Run Code Online (Sandbox Code Playgroud)

jquery jquery-ui referenceerror

14
推荐指数
1
解决办法
18万
查看次数

未捕获的ReferenceError:$ jQuery中未定义错误

我有这个代码jQuery:(文件名是javascript.js ...之前我使用的是JavaScript ...)

$(document).ready(function() {
 $("#readFile").click(function() {
    $.get('test.txt', function(data) {
      $("#bottom_pane_options").html(data); // #bottom_pane_options is the div I want the data to go
    }, 'text');
 });
});
Run Code Online (Sandbox Code Playgroud)

...这在HTML中:

<!DOCTYPE html>
<html>
<head>
    <title>Culminating</title>
    <link href="style.css" rel="stylesheet" type="text/css">

    <script type="text/javascript" src="./javascript.js"></script>
    <script
        src="http://maps.googleapis.com/maps/api/js?key=AIzaSyCJnj2nWoM86eU8Bq2G4lSNz3udIkZT4YY&sensor=false">
    </script>

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


    <script>
        function initialize()
        {
        var mapProp = {
          center:new google.maps.LatLng(50.569283,-84.378433),
          zoom:5,
          mapTypeId:google.maps.MapTypeId.TERRAIN
          };
        var map=new google.maps.Map(document.getElementById("googleMap"),mapProp);
        }

        google.maps.event.addDomListener(window, 'load', initialize);
    </script>
</head>

<body>
    <div class="content">
        <div id="googleMap"></div>
        <div id="right_pane_results">hi</div>
        <div id="bottom_pane_options">
            <button id="readFile">Read File</button> …
Run Code Online (Sandbox Code Playgroud)

html javascript file-io jquery

9
推荐指数
3
解决办法
18万
查看次数

未捕获的ReferenceError:$未定义

我在尝试创建JQuery图像滑块时收到此错误消息.

未捕获的ReferenceError:$未定义

这是我的新编码(请注意,我已将脚本移至页面,这是adobe建议的.):

<!doctype html>
<html>

<head>
<meta charset="utf-8">
<title>Green Cold-Formed Steel | Home</title>
<style type="text/css">

body,td,th {
    font-family: Tahoma, Geneva, sans-serif;
    font-size: 10px;
    color: #000;
    text-align: left;
}
body {
    background-color: #999;
}
a:link {
    color: #999;
    text-decoration: none;
}
a:visited {
    text-decoration: none;
    color: #060;
}
a:hover {
    text-decoration: underline;
    color: #FFF;
}
a:active {
    text-decoration: none;
}
h1 {
    font-size: 14px;
    color: #060;
}
h2 {
    font-size: 12px;
    color: #999;
}
h3 {
    font-size: 9px;
    color: #FFF; …
Run Code Online (Sandbox Code Playgroud)

javascript jquery image referenceerror

8
推荐指数
2
解决办法
11万
查看次数

YouTube iFrame API行为不一致/不确定

我无法通过iframe/HTML5 API隔离我的JavaScript代码中的错误来控制Youtube视频.

我回到主要文档页面上的演示代码:

https://developers.google.com/youtube/iframe_api_reference

...令我惊讶的是,即使我从那里使用演示代码而且没有改变任何东西,我也会看到相同的不一致行为.

行为是在某些时候,当我加载此页面时,播放器自动播放(这是代码的意图),有时则不然.它总是在加载方面成功.此外,玩家似乎永远不会在6秒后停止,与评论所说的相反.

断点验证至少部分问题onPlayerReady()并不总是被调用.当我设置断点时onPlayerReady(),通常不会到达,并且只达到玩家继续成功进行自动播放的次数.

当然,这种行为可能取决于我的互联网连接的速度和可靠性,这是有线的,否则看起来相当快.我刚刚测试了它--24 Mbps,看起来非常一致.

如果我对html进行表面的更改,那么有时会提示页面加载到自动播放,但并非总是如此.有时我连续5次重新加载,没有自动播放或onPlayerReady断点被击中,然后第6次这样做,那时它会自动播放罚款.

我在Mac OS 10.8.4上使用Chrome v30.0.1599.101.

我知道代码处于测试阶段且处于不稳定状态,并且不应该是生产级别,但我希望有一些我可以尝试的东西.

这是我正在使用的代码,仅供参考,以防上面的api参考页面上发布的代码发生变化.再说一遍,我不会改变一个角色.

<!DOCTYPE html>
<html>
  <body>
    <!-- 1. The <iframe> (and video player) will replace this <div> tag. -->
    <div id="player"></div>

    <script>
      // 2. This code loads the IFrame Player API code asynchronously.
      var tag = document.createElement('script');

      tag.src = "https://www.youtube.com/iframe_api";
      var firstScriptTag = document.getElementsByTagName('script')[0];
      firstScriptTag.parentNode.insertBefore(tag, firstScriptTag);

      // 3. This function creates an <iframe> (and YouTube player)
      //    after the API …
Run Code Online (Sandbox Code Playgroud)

javascript iframe jquery html5 youtube-api

5
推荐指数
1
解决办法
5024
查看次数

TypeError:$(...)。tooltip不是webpack的函数

我正在尝试将我的应用程序从requirejs迁移到webpack 2,但是遇到了麻烦。

我的webpack配置:

 rules: [
            // rules for modules (configure loaders, parser options, etc.)

            {
                test: /\.jsx?$/,
                include: [
                    path.resolve(__dirname, "src")
                ],
                exclude: [
                    path.resolve(__dirname, "app/demo-files")
                ],

                enforce: "pre",
                enforce: "post",

            },

            {
                test: /underscore/,
                loader: 'expose-loader?_'
            },
            {
                test: /howler/,
                loader: 'expose-loader?Howl'
            },
            {
                test: /pathfinding/,
                loader: 'expose-loader?PF'
            },
            {
                test: /stats/,
                loader: 'expose-loader?Stats'
            },
            {
                test: /datgui/,
                loader: 'expose-loader?dat.gui'
            },
            { test: /jquery/,
                loader: 'imports?jQuery=jquery,$=jquery,this=>window'
            },
            {
                test: /jquery-ui/,
                use: [
                    'expose-loader?$',
                    'imports-loader?this=>window,jquery'
                ]
            }
Run Code Online (Sandbox Code Playgroud)

在插件部分:

plugins: [ …
Run Code Online (Sandbox Code Playgroud)

jquery jquery-ui webpack webpack-2

5
推荐指数
1
解决办法
2156
查看次数

未捕获的ReferenceError:$未定义

我一直在得到未定义的错误,我不知道如何解决它.

这是我的代码:

<script type="text/javascript">
    function returnBlurayDisc(member_id){
         var xmlhttp;

         if (window.XMLHttpRequest){
              xmlhttp=new XMLHttpRequest();
     }else{
          xmlhttp=new ActiveXObject("Microsoft.XMLHTTP");
     }

     xmlhttp.onreadystatechange=function(){
          if (xmlhttp.readyState==4 && xmlhttp.status==200){
         document.getElementById("popup_container").innerHTML=xmlhttp.responseText;
         $("#GrayBackground").css({'height':'1900px','display':'inline'});

           }
     }

     xmlhttp.open("GET","ajax/returnAjax.php?member_id="+member_id+"&name="+name);
     xmlhttp.send();    
     }
</script>
Run Code Online (Sandbox Code Playgroud)

错误是Uncaught ReferenceError:$未定义.请帮助我.

javascript jquery

4
推荐指数
1
解决办法
1万
查看次数