Abhinav Vemulapalli
Abhinav Vemulapalli

Reputation: 148

Jquery.js error

I have a main page with 2 buttons linked to a registration page and the other to a login page. In the chrome debugger it shows the error:

jquery.js:2 
Uncaught Error: Syntax error, unrecognized expression: 
html/first-time-login/first-time-login.php
    at Function.fb.error (jquery.js:2)
    at fb.tokenize (jquery.js:2)
    at fb.select (jquery.js:2)
    at Function.fb [as find] (jquery.js:2)
    at m.fn.init.find (jquery.js:2)
    at m.fn.init (jquery.js:2)
    at m (jquery.js:2)
    at HTMLAnchorElement.<anonymous> (custom.js:92)
    at HTMLAnchorElement.dispatch (jquery.js:3)
    at HTMLAnchorElement.r.handle (jquery.js:3)

Here is my HTML code for the links:

<a href="html/login/login.php" class="wow fadeInUp btn btn-default hvr-bounce-to-top smoothScroll" data-wow-delay="1.3s">Login</a>
<a href="html/first-time-login/first-time-login.php" class="wow fadeInUp btn btn-default hvr-bounce-to-top smoothScroll" data-wow-delay="1.3s">register</a>

Also here is my custom.js line 92 code:

scrollTop: $($anchor.attr('href')).offset().top - 49

That line is in this function:

$(function() {
        $('#home a, .navbar-default a').bind('click', function(event) {
            var $anchor = $(this);
            $('html, body').stop().animate({
                scrollTop: $($anchor.attr('href')).offset().top - 49
            }, 1000);
            event.preventDefault();
        });
    });

Also if you wanted to know I am using a template. I forgot exactly where I got it from, though. Thanks to anyone for helping me

Upvotes: 0

Views: 970

Answers (1)

JorgeeFG
JorgeeFG

Reputation: 5981

Try removing the class smoothScroll of your link class attribute.

Example:

<a href="html/first-time-login/first-time-login.php" class="wow fadeInUp btn btn-default hvr-bounce-to-top" data-wow-delay="1.3s">register</a>

I think smoothScroll expects that the href attribute contains the id (or a valid JQuery selector string) of another element in the same page, so it can scroll down or up to this element. Since this is not happening in your page, it trhows an error.

Upvotes: -1

Related Questions