Thank you! This will work perfectly. Yes, I need the link to be followed, because it loads content into a div using ajax, so, removing return false; will be what i need. Any thank you for commenting the code! That really helps for beginners!
On Jun 26, 1:15 am, sheshnjak <[EMAIL PROTECTED]> wrote: > Hi, I think this should work for you: > > - Basically, you have this in html: > <div class="targetLinkList"> > <a href="1">bla1</a><br /> > <a href="2">bla2</a><br /> > <a href="3">bla3</a><br /> > </div> > - To see the results put this in your css: > a.clicked {background-color: red} > > - And finally, you should put this in js file: > > $("a").click(function(){ > $(".targetLinkList a.clicked").removeClass("clicked"); // remove > previous class if there is any > $(this).addClass("clicked"); // > add class to the clicked link > return > false; // > this prevents browser from following clicked link > > }); > > This should work, but I'm not sure you really asked the right > question. If you omit last js line (return false;), then browser will > apply clicked class, but it will follow clicked link and you will > never stay on the page long enough to see the change, whatever it is > you intended. If this doesn't help, give me more details and I'll try > to help...http://www.tomislavdekovic.iz.hr/