<script type="text/javascript" src="/js/jquery.js"></script> <script type="text/javascript"> $(document).ready(function() { $("td:nth-child(3)").addClass("number_right"); }); </script>
<script type="text/javascript"> $(document).ready(function() { $("fact").replaceWith("<sup class='template_fact'>[<i><a href='http://en.wikipedia.org/wiki/Wikipedia:Citation_needed'>citation needed</a></i>]</sup>"); }); $("todo").each( function() { var txt = $(this).attr("descr"); $(this).empty().append("<sup class='template'>[<i>todo — <span></span></a></i>]</sup>").find('span').text( txt ); }); </script> George W. Bush is a moron.<fact /> <todo descr='what can we do about it?' />In this case, every <fact /> tag will be replaced with [citation needed].
While this works in all modern browsers, I've seen rumors that it fails in older browsers. Specifically that such ad-hoc elements weren't included in the final DOM parse-tree, because they were seen as superfluous. (TODO: figure out which versions)
There are several more complete "template engines" for jQuery: spin-off of Ext, textareas