<!DOCTYPE html PUBLIC "- "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html
xmlns="http://www.w3.org/1999/xhtml"
xmlns:bn="http://www.bennadel.com">
<head>
<title>Using jQuery With Custom XHTML Attributes</title>
<script type="text/javascript" src="jquery-1.2.6.min.js"></script>
<script type="text/javascript">
$(
function(){
var jLI = $( "li" );
jLI.each(
function( intI ){
var jThis = $( this );
var jLink = $( "<a></a>" );
jLink.text(
jThis.text().replace(
new RegExp( "^\\s+|\\s+$", "g" ),
""
)
);
jLink.attr(
{
"href": jThis.attr( "bn:imdb" ),
"bn:rel": "Pretty Cool Ladies"
}
);
jThis
.empty()
.append( jLink )
;
}
);
}
);
</script>
</head>
<body>
<h1>
Pretty Cool Ladies
</h1>
<ul>
<li bn:imdb="http://www.imdb.com/name/nm0004742/">
Maria Bellow
</li>
<li bn:imdb="http://www.imdb.com/name/nm0184965/">
Christina Cox
</li>
<li bn:imdb="http://www.imdb.com/name/nm0226459/">
Ani DiFranco
</li>
</ul>
</body>
</html>