Posted on Wednesday 6 December 2006 - Popularity: unranked

Just a few jQuery code snippets I’m using on the jMe feed aggregator that may be useful to some:
if (i > 10){
$(this).remove();
}
});
This one removes all childrens from #mydiv with a count greater than ten. Useful if you want to limit the number of childrens inside an element where you dynamicaly add new elements. jMe is using this one for the spy feature.
this.target = "_blank";
});
The description of feed items can contain links, not all of them use ‘_blank’, so it can happen that they open in the same window. To solve this problem, the above code changes all links inside elements with a class ‘mydesc’ to open in a new blank window. Normaly to do that you would have to use regular expressions, not so with the help of jQuery.
this.blur();
});
I really don’t like those dotted rectangles that get put around links you click, especially if those links just trigger some JavaScript and not a new page. The above snippet takes those ugly attention grabbers away. Don’t forget to run this code everytime you dynamicaly add new links.
This little snippet here moves an element one step up in a set of elements. This is more or less what I use in jMe on the
button of previously selected elements.
Basicaly the same as above, just in the other direction (one step down).
Fredi










