i have markup looks this:
<div id="breadcrumb"><a href="http://domain.com/site/">site</a> » <a href="http://domain.com/site/sub/"></a> » <a href="http://domain.com/site/sub/sub/">heading</a> » document title</div>
on page, looks like:
site » » heading » document title
i'd use jquery empty "a" tag, remove it, , remove 1 of >> characters.
i have this:
$(document).ready(function() { if ($('#breadcrumb').length) { $('#breadcrumb a:empty').replacewith('-'); $('#breadcrumb').html($('#breadcrumb').html().replace(/» - »/, "»")); } });
notice >> characters in javascript code itself. works, doesn't seem right. looking proper way find character via regex. or, looking code fine. :) i've tested it, , seems work in browsers i've used. thanks.
(i fix process creates these breadcrumbs, no longer outputs empty tag... looking stop-gap!)
you're good, regex expressions in javascript denoted using slashes in same way string denoted quotes. it's confusing when first see valid javascript regex expression.
Comments
Post a Comment