[jQuery] Re: Help Me Optimize My First JQuery Script (Extinguish The Early Flames of Bad Practices)

2009-04-15 Thread MorningZ
I don't know if this falls under bad practice or not, but time and time again here on the group, people post code like yours where they use an a tag to do something that has nothing to do with an a tag If you don't want to go somewhere, why not just use a span or a div and hang the click event

[jQuery] Re: Help Me Optimize My First JQuery Script (Extinguish The Early Flames of Bad Practices)

2009-04-15 Thread Karl Swedberg
On Apr 15, 2009, at 6:50 AM, MorningZ wrote: I don't know if this falls under bad practice or not, but time and time again here on the group, people post code like yours where they use an a tag to do something that has nothing to do with an a tag If you don't want to go somewhere, why not

[jQuery] Re: Help Me Optimize My First JQuery Script (Extinguish The Early Flames of Bad Practices)

2009-04-15 Thread Ricardo
If you gave your buttons a common class you could do something like this: $(li.button a).click(function(event){ //show the link's parent, hide the parent's siblings $(this) .parent().show() .siblings().hide(); return false; }); On Apr 14, 11:49 pm, Dante danh...@gmail.com

[jQuery] Re: Help Me Optimize My First JQuery Script (Extinguish The Early Flames of Bad Practices)

2009-04-15 Thread Dante
That's exactly what I was looking for, Ricardo! Thank you. I suspected the code could be simplified using parent/sibling selectors; I was just unsure how to do so. On Apr 15, 6:38 pm, Ricardo ricardob...@gmail.com wrote: If you gave your buttons a common class you could do something like