[jQuery] Help with syntax
Hi everyone, I've been playing with jQuery a lot lately but my skills
could use a lot of work. I recently made this small snippet of script
to show and hide tablerows from a link that looks like this:
<a href="1" class="ahref">1</a>
this will show:
<tr class=box1 box">
<td>etc</td>
</tr>
Javascript:
$(function(){
$('.box').hide(); /* hide every tr with class box at the start */
$('.ahref',this).click(function () {
var id = $(this).attr('href');
$('.box'+id).toggle();
$("tr.box:not('.box"+id+"')").hide(); /* so it will hide all the
other TR's */
return false; /* so it doesn't follow the link itself */
});
});
Now I was wondering if anyone would like to critique it, I find it is
a bit slow at times.
Thanks a lot in advance!