9
Answers

how to put code from js fiddle in to my .master page

deepa ashwi

deepa ashwi

10y
1.4k
1
Hi friends,
after clicking a menu it should get highlighted (to show user in which page they are in)for this i used jquery and its working well in js fiddle but when i use the same in my .master page of my asp.net website highlight function is not working .i added

src="https://ajax.googleapis.com/ajax/libs/jquery/1.8.3/jquery.min.js


also but still not working can anyone tell me where im going wrong?
<pre lang="HTML"> //css// .highlight{ background-color:green; }   #horizontalmenu ul { padding:1; margin:1; list-style:none; } #horizontalmenu li { float:left; position:relative; padding-right:100; display:block; border:4px solid #CC55FF; border-style:inset; } #horizontalmenu li:hover { float:left; position:relative; padding-right:100; display:block; border:4px solid #CC55FF; border-style:inset; background:yellow; } #horizontalmenu li ul { display:none; position:absolute; } #horizontalmenu li:hover ul{ display:block; background:red; height:auto; width:8em; } #horizontalmenu li ul li{ clear:both; border-style:none;}


  <div id="horizontalmenu"> <ul> <li><a href="#">News</a> <ul> <li><a href="#">National</a></li> <li><a href="#">International</a></li> <li><a href="#">Sport</a></li> <li><a href="#">Hollybood</a></li> </ul> </li> <li> <a href="#">Technology</a> <ul> <li><a href="#">IT/Software</a></li> <li><a href="#">Hardware</a></li> <li><a href="#">Iphone</a></li> <li><a href="#">Neuro-Science</a></li> </ul> </li> <li> <a href="#">Sports</a> <ul> <li><a href="#">Cricket</a></li> <li><a href="#">Tenis</a></li> <li><a href="#">Badminton</a></li> <li><a href="#">Hockey</a></li> </ul> </li> <li> <a href="#">Country</a> <ul> <li><a href="#">India</a></li> <li><a href="#">America</a></li> <li><a href="#">France</a></li> <li><a href="#">Pakistaan</a></li> </ul> </li> </ul> </div>


    //javascript//     $('#horizontalmenu li').click(function(){ $('.highlight').removeClass('highlight'); $(this).addClass('highlight');   });    


Answers (9)