Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 1104223
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 17, 20262026-05-17T01:27:13+00:00 2026-05-17T01:27:13+00:00

I started to implement some new html5 features (standards, nothing fancy) in my project.

  • 0

I started to implement some new html5 features (standards, nothing fancy) in my project. Just the standard header, footer, aside, ect. For some reason a javascript code that I used on a past project doesn’t work now and I can’t figure out what the problem is.

I compared the code (html/javascript) with my new project and the past project (with javascript working) and I don’t see any difference. The only thing I can think of is the change in html versions.

By the way Im trying to implement a script that highlights a current link from a menu. It is supposed to use javascript to add/remove a “.selected” code the anchor tags in the menu and relates to the current page and link.

here is the code:

<aside>
        <section>
            <Strong>Quick Links</strong>
                <menu id="side_menu">
                    <ul>
                        <li><a href="application.php">Sign Up</a></li>
                        <li><a href="testimonials.php">Testimonials</a></li>
                        <li><a href="diploma.php">The Process</a></li>
                        <li><a href="diploma.php">Course Listings</a></li>
                        <li><a href="about.php">American High School</a></li>
                     </ul>
                </menu> 

        <script>
            $(document).ready(function() {
                var loc = window.location.href; // The URL of the page we're looking at
                $('#side_menu a').each(function() {
                    if (loc.indexOf(this.href) !== -1) { // If the URL contains the href of the anchor
                            $(this).addClass('selected'); // Mark it as selected
                    }
                });
            });
        </script>

        </section>
</aside> 

Here is the link to the site here (Side Panel)

I would appreciate any help on this issue. I spent hours trying to figure this out. Thanks for any help.

gdinari

  • 1 1 Answer
  • 2 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-17T01:27:14+00:00Added an answer on May 17, 2026 at 1:27 am

    One problem is that you’re trying to use Prototype before you’ve included it. Move your script tag for js/prototype.js above your script tag for js/drop-o-matic.js.

    If you use a debugger (Chrome’s Dev Tools, Firebug for Firefox, Script Debugger for IE, …) it should tell you that. In this case, for instance, Chrome’s Dev Tools showed me Uncaught TypeError: Object #<an HTMLDocument> has no method 'observe' , which immediately pointed me in the right direction — your DOM loaded function isn’t being run because you’re trying to hook it up before document.observe is added by Prototype.


    After you fixed the above, the console said Uncaught TypeError: Object #<an HTMLDocument> has no method 'ready'. And that’s because you’re trying to use jQuery code without including jQuery:

    $(document).ready(function() {
        var loc = window.location.href; // The URL of the page we're looking at
        $('aside li a').each(function() {
            if (loc.indexOf(this.href) !== -1) { // If the URL contains the href of the anchor
                $(this).addClass('selected'); // Mark it as selected
            }
        });
    });
    

    You can use jQuery as well as Prototype if you like, but if it’s just for that snippet, I’d convert it to Prototype code instead:

    document.observe("dom:loaded", function() {
        var loc = window.location.href; // The URL of the page we're looking at
        $$('aside li a').each(function(link) {
            if (loc.indexOf(link.href) !== -1) { // If the URL contains the href of the anchor
                link.addClassName('selected'); // Mark it as selected
            }
        });
    });
    

    If you’re using jQuery code elsewhere, you’ll want to include jQuery and use jQuery.noConflict, which allows Prototype to keep the $ symbol (you have to use jQuery instead where you want jQuery’s function, or use the jQuery load function as a scoping function).

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am trying some new C++11 features on visual studio 11, started with the
I have just started a new project using a Linq to Sql model and
Recently I have started to implement new experimental feature for my project. Unfortunately I
I have just added a new Admin area to my project as its started
I'm pretty new to Java web application and I just started a sample project
I´ve just started learning GWT and I´m trying to implement http://gwt.google.com/samples/Showcase/Showcase.html#!CwFileUpload and but failing
I started my project in Asp.net MVC(c#) & SQL Server 2005.I want to implement
I've recently started a new web development project for an embedded device and wanted
I am just started coding of device driver and new to threading, went through
I recently started a project and needed to do some integration with LDAP via

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.