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

  • SEARCH
  • Home
  • 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 6046565
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 23, 20262026-05-23T07:15:16+00:00 2026-05-23T07:15:16+00:00

I´m just learning Prototype and I´m having a hard time finding good documentation/tutorials, I

  • 0

I´m just learning Prototype and I´m having a hard time finding good documentation/tutorials, I think that this problem should be easy to do, but I just can’t get it to work. I want to have hover effects on a div until its clicked on, then after its clicked on I want it to have normal behaviour. This is what I have so far:

document.observe("dom:loaded", function() {
        $("evtTarget").observe("mouseover", highlight);
        $("evtTarget").observe("mouseout", highlight);

        $("evtTarget").observe("click", function(evt) {
            $("evtTarget").stopObserving("mouseover", highlight);
            $("evtTarget").stopObserving("mouseout", highlight);
        });


    });

    function highlight(evt) {
        $("evtTarget").toggleClassName("highlighted");        
    }

When I use this code, my div doesn´t highlight, but I can´t figure out what I´ve done wrong. Any help or suggestions would be greatly appreciated!!!

Thanks!

edit: here´s my jsfiddle version:
http://jsfiddle.net/jaFuP/1/

  • 1 1 Answer
  • 0 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-23T07:15:16+00:00Added an answer on May 23, 2026 at 7:15 am

    Works just fine for me. The problem is likely elsewhere.

    • Is there an element in the page with ID evtTarget?
    • Did you remember to include Prototype in the page (e.g.
      <script src="path/to/prototype.js></script>)?
    • Are there any errors that show up in the console that might be preventing your JavaScript from fully executing?
    • Did you actually define a CSS highlighted class with styles other than what the element with id evtTarget already has?
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Am just learning C and this is my first time on stackoverflow so am
I'm just learning Objective-C/Cocoa programming for the Mac. All of the tutorials, books, blogs,
just learning as3 for flex. i am trying to do this: var someNumber:String =
Just learning about mercurial's --style and --template options that can be used on hg
I am just learning about app.config in respect of creating custom sections. I have
I'm just learning Ruby on Rails. I've read a few books, I've watched lots
I'm just learning to work with partial classes in VB.NET and VS2008. Specifically, I'm
I'm just learning about SVG, and it seems great but I'm not sure about
I'm just learning Perl. When is it advisable to use OO Perl instead of
I'm just learning asp.net mvc and I'm trying to figure out how to move

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.