JQuery代码没有任何效果

时间:2015-12-08 09:49:23

标签: javascript jquery html

我已经在我的网站模板中添加了一个脚本,但它不起作用。

我认为这可能是由于JS冲突,但在使用firebug时,我看不到任何异常。

这是链接:

Link

我的JS代码如下

jQuery.noConflict();
jQuery(document).ready(function ($) {
// Using jQuery Event API v1.3
  $('#quote_home').on('click', function() {
ga('send', 'event', 'a', 'click', 'quote_home'); });
$('#quote_landlord').on('click', function() {
ga('send', 'event', 'a', 'click', 'quote_landlord');});
$('#quote_lerg').on('click', function() {
ga('send', 'event', 'a', 'click', 'quote_lerg');});
 $('#quote_business').on('click', function() {
ga('send', 'event', 'a', 'click', 'quote_business');});
$('#quote_tenant').on('click', function() {
ga('send', 'event', 'a', 'click', 'quote_tenant');
});
$('#quote_holidayhome').on('click', function() {
ga('send', 'event', 'a', 'click', 'quote_holidayhome');
});
$('#quote_referencing').on('click', function() {
ga('send', 'event', 'a', 'click', 'quote_referencing');});
$('#quote_mortgages').on('click', function() {
ga('send', 'event', 'a', 'click', 'quote_mortgages');
});});

此代码用作Google Analytics的一部分,以便跟踪网站上的活动。

1 个答案:

答案 0 :(得分:1)

此更改可能对您有所帮助。 我在这里找到了一个使用

的代码
$(document).ready(myFunction);

更改它
jQuery(document).ready(myFunction);