Monday, May 20, 2024
 Popular · Latest · Hot · Upcoming
27
rated 0 times [  29] [ 2]  / answers: 1 / hits: 42058  / 11 Years ago, mon, april 8, 2013, 12:00:00

I'm trying to make an JS, but since I'm not an expert on that, maybe someone could help me. I was searching for that in Google and in Stack Overflow, but didn't find what I need. I just found onmouseover that change the class in element itself. But I want something different:



I want to make a onmouseover on a tag to change the class closed to open in other element. Example:



<a href=# onmouseover=<active event>>Link</a>



<ul class=dropdown closed><li>Item</li></ul>



Regards,


More From » javascript

 Answers
73

If you include jQuery:



Add id for your elements:



<a href=# id=a1>Link</a>
<ul class=dropdown closed id=ul1><li>Item</li></ul>


Javascript:



$(#a1).mouseover(function(){
$(#ul1).addClass(open).removeClass(closed)
})

[#79037] Monday, April 8, 2013, 11 Years  [reply] [flag answer]
Only authorized users can answer the question. Please sign in first, or register a free account.
jaylynkarinam

Total Points: 740
Total Questions: 103
Total Answers: 103

Location: Liechtenstein
Member since Wed, Dec 8, 2021
3 Years ago
;