我无法解决控制台出现此错误的问题:Uncaught TypeError: $ is not a function
.这是它指向的代码:
<script type="text/javascript">
$(document).ready(function() {
$(".linky").click(function(){
var t = $(this); //<-ERROR POINTS HERE
var y = $("#0"+t.attr("id")).offset().top;
$('html,body').animate({scrollTop: y},500);
});
});
</script>
Run Code Online (Sandbox Code Playgroud)
任何帮助将非常感激!
我有这些代码行,这是错误消息的原因.在我看来,代码中没有错误,但我想我错了:
jQuery(document).ready(function() {
console.log("ready!");
$("#hover-table").hover(function() { // THIS IS LINE 164
$('#table-wrapper').show();
}, function() {
$('#table-wrapper').hide();
});
});
Run Code Online (Sandbox Code Playgroud)
我在Chrome控制台中收到此错误消息.的console.log
印有没有问题.
(index):164 Uncaught TypeError:$不是
HTMLDocument中的函数.((索引):164)
在i.(jquery.js?ver = 1.12.4:2)
处于Object.fireWith [as resolveWith](jquery.js?ver = 1.12.4:2)
在Function.ready(jquery. js?ver = 1.12.4:2)
在HTMLDocument.K(jquery.js?ver = 1.12.4:2)
我在这里错过了什么?
我正在尝试将分页和排序添加到我的表中,但出现此错误,但是我遵循此处列出的所有步骤 http://l-lin.github.io/angular-datatables/#/getting-started。
我已经检查了之前的问题,但我没有和我一起工作
我安装了它的所有依赖项
这是该组件的代码:-
import { Component, OnInit, OnDestroy } from '@angular/core';
import { ProductService } from '../../service/product-service.service';
import { Subscription, Subject } from 'rxjs';
@Component({
selector: 'app-admin-products',
templateUrl: './admin-products.component.html',
styleUrls: ['./admin-products.component.css']
})
export class AdminProductsComponent implements OnInit, OnDestroy {
products: any[];
filteredProducts: any[];
subscribtion: Subscription;
dtOptions: DataTables.Settings = {};
dtTrigger: Subject<any> = new Subject();
constructor(private productService: ProductService) {
this.subscribtion = productService.getAll().
// We take a copy of Products and Assigned to filteredProducts
subscribe(
products => {
this.filteredProducts …
Run Code Online (Sandbox Code Playgroud)我在我的网站上的这个脚本导致了一些意外错误:Uncaught ReferenceError: $ is not defined
它应该重写enter的功能,作为站点表单输入中的选项卡,而不是提交该表单.
<script type="text/javascript">
$('input').keypress(function(e) {
if (e.which == 13) {
<--! says error is here within the $ symbol -->
$(this).next('input').focus();
e.preventDefault();
}
});
</script>
Run Code Online (Sandbox Code Playgroud)