Custom Tags, using jQuery Replacement
HTML
<link rel="stylesheet" href="http://www.hacres.com/css/style.css">
<html>
<head><title>Custom Tags, using jQuery Replacement</title></head>
<body>
<h2>Health Minister Training</h2>
<jtag type="onTheRoad" key="110"></jtag>
<h2>3 Days to Health</h2>
<jtag type="onTheRoad" key="126"></jtag>
<h2>God's Way to Ultimate Health</h2>
<jtag type="onTheRoad" key="128"></jtag>
<h2>Where Do I Go From Here?</h2>
<jtag type="onTheRoad" key="129"></jtag>
<h2>Latest Recipes</h2>
<jtag type="latestRecipes" limit="3" desc="1"></jtag>
</body>
</html>
JavaScript
$(document).ready(function() {
$("jTag").each(function() {
var jTag = $(this);
jTag.html('<a href="http://www.hacres.com/education/event-calendar"><img src="http://www.hacres.com/images/loading.gif" alt="Click here for event listing..." border="0" /></a>');
var jTagUrl = "http://www.hacres.com/inc/jQueryTags.php?v=2.1";
var attrs = ['type', 'src', 'key', 'rand', 'desc', 'limit', 'more'];
$.each(attrs, function(i, a) {
if (jTag.attr(a)) jTagUrl += '&' + a + '=' + jTag.attr(a);
});
jTag.load(jTagUrl, function() {
jTag.replaceWith(jTag.html());
});
});
});