Syntax error in console

Robert Granlund
Robert Granlund used Ask the Experts™
on
Syntax error in console:
jquery-2.2.4.min.js?ver=null:2 Uncaught Error: Syntax error, unrecognized expression: http://downtowndurham.com/psp/

<html>
<ul class="select">
<li class="active"><a class="anchorLink" href="#myoverview" rel="" name="introduction">Overview</a></li>
<li><a href="#my2019projects">Projects</a></li>
<li><a href="#my2019selectionaacommittee">Selection Committee</a></li>
<li><a href="#myapply">Apply</a></li>
<li><a href="#mysponsorship">Sponsorship</a></li>
<li><a href="#mysignup">Sign-up</a></li>
<li><a href="http://downtowndurham.com/psp/">Public Space Project</a></li>
</ul>

Open in new window

Comment
Watch Question

Do more with

Expert Office
EXPERT OFFICE® is a registered trademark of EXPERTS EXCHANGE®
leakim971Multitechnician
Top Expert 2014
Commented:
your last link "Art About" is not like the other links :

this is in your "index" page :
    scrollItems = menuItems.map(function(){
      var item = $($(this).attr("href")); // this command fail because we pass "../artabout/" to the jQuery selector which is not a valid selector
// $("../artabout/") is not a valid selector
      if (item.length) { return item; }
    });

Open in new window


so replace by :
scrollItems = menuItems.map(function(){
  var href = $(this).attr("href");
  var item = (href.indexOf("#") == 0) ? $(href) : [];
  if (item.length) { return item; }
});

Open in new window


Capture-d-e-cran-2019-09-11-a--18.56.png

Author

Commented:
Thank you this helps a lot.  However Now I get this error:
Uncaught Error: Syntax error, unrecognized expression: [href=#]
Multitechnician
Top Expert 2014
Commented:
so test length too: (href.indexOf("#") == 0 && href.length>1)
Success in ‘20 With a Profitable Pricing Strategy

Do you wonder if your IT business is truly profitable or if you should raise your prices? Learn how to calculate your overhead burden using our free interactive tool and use it to determine the right price for your IT services. Start calculating Now!

Author

Commented:
I found the issue.  Thanks for your help.

Author

Commented:
I found the issue.  Thanks for your help.
leakim971Multitechnician
Top Expert 2014
Commented:
you welcome!

Do more with

Expert Office
Submit tech questions to Ask the Experts™ at any time to receive solutions, advice, and new ideas from leading industry professionals.

Start 7-Day Free Trial