View Single Post
Old 06-19-2012, 05:44 AM   PM User | #24
Lerura
Regular Coder

 
Lerura's Avatar
 
Join Date: Aug 2005
Location: Denmark
Posts: 869
Thanks: 0
Thanked 112 Times in 111 Posts
Lerura will become famous soon enough
I will try!

I forgot that since addClass and removeClass are jQuery functions, the reference to the object must be written $(this), instead of this

The other issue that I discovered while playing with the code is that
Code:
this.href
returns the absolute URL of the link, and not just the relative URL that I expected;

And now I have just noticed that I forgot the remove
Code:
else{
$(this).removeClass('Active');
}
when changing from when i changed from:
Code:
$('#treemenu1').find('a').click(function(){
to
Code:
$(function(){
it is necessary when the code is "onclick" as it needs to reset the previous assignment, but when "onload" the assignments are automatically reset, due to the reloading of the page.

It does no harm, but is completely necessary "onload"
----
Just ask away. if you need more information.
Lerura is offline   Reply With Quote