I was hoping to indent a number, but the with html generated from my cms I can't seem to hook into the number and apply a style.
<div class="content">
<b>01. Header</b>
Lorem ipsum dolor sit amet, consectetur
adipisicing elit, anim odio hic autem
delectus qui labore rerum irure autem
</div>
I would like to wrap the number in a span. All of the content is the same. 02.[space]Title
<div class="content">
<span="indent">01. </span><b>Header</b>
Lorem ipsum dolor sit amet, consectetur
adipisicing elit, anim odio hic autem
delectus qui labore rerum irure autem
</div>
.indent{
margin-left: -30px;
}
Here is what I have started but I can't seem to trim it to the first 3 characters including the empty space.
$('.content b').each(function() {
var tmp = [],
collecting = false;
$(this).contents().each(function() {
if (this.nodeType === Node.TEXT_NODE && $.trim(this.nodeValue).length > 0) {
if (collecting) {
tmp.push(this);
return false;
}
else {
collecting = true;
}
}
if (collecting) {
tmp.push(this);
}
});
$(tmp).wrapAll('<span class="indent" />');
});