Hi folks,
The following function takes an image tag (or table) that appears
within a p tag container in the form
< p> <img> text < /p>
and wraps the image (and caption if a title is present) into a div
for floating left, right, or centering.
My problem is that I don't know how to shift the processed image from
within the p container to immediately before it (so that the created
div is not within a p container)
I'd appreciate help in this next step.
Thanks,
Bruce
function fnDoImages() {
$('img.imgposl,img.imgposr,img.imgposc,img.tblposl,img.tblposr,img.tblposc').each(function(i)
{
var a = $(this).attr('alt');
var q = $(this).attr('class').substr(0,3);
var p = $(this).attr('class').substr(6);
var t = $(this).attr('title');
var w = $(this).attr('width');
if (a.length=0) {
$(this).attr('alt',''+t+'');
}
$(this).wrap("<div class='buggybox clearfix'
id='g"+i+"'></div>");
if (q=='tbl' && t.length>0) {
$(this).before("<p class='imgcaption'
style='width:"+w+"px;'>"+t+"</p>");
} else if (t.length>0){
//$(this).after("<p class='imgcaption'
style='width:"+w+"px;'>"+t+"</p>");
};
$("#g"+i).addClass("img"+p).css({width:w+'px'});
});
}