开发者

CKEditor, Jquery - find and replace HTML

I am totally new to CKEditor, hence please bear with my stupid questions. I have a CMS that uses CKEditor to enter articles into a DB. I have been asked to write a plugin to the editor to do a particular task which is as follows:

I have an image in the editor. Whe开发者_如何学Pythonn I click on the image to select it and click on a button that I coded it gets me the image html like <img src="imageurl" border="0" />. Now I need to find out if the image tag is wrapped with furthermore html like:


<div class="photo">
    <p class="inner">
        <img src="imageurl" border="0" /><span>some text here</span>
    </p>
</div>

if yes, I need to be able to edit the text in the span tag and be able to add inline style to DIV or P, if not I need to wrap <img src="imageurl" border="0" /> with :


<div class="photo">
    <p class="inner">
        <img src="imageurl" border="0" /><span>some text here</span>
    </p>
</div>

P.S. I can sit thru and may be come up with a solution if I has sometime. But my deadline is too close!

Could someone please please help me with this? Your help is much appreciated.

Thanks, R


I think you can use the Jquery function parent() to get the "higher levels" in your html structure starting from <img />

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜