是否可以在Image2 ckeditor插件中更改Image的Wrapper“<div>”?

时间:2017-04-27 06:04:48

标签: javascript jquery html ckeditor

我正在使用带有CKeditor的image2插件,我来到了不能使用“Div”作为图像包装器的情况。

当Captioned小部件与中心alginment一起使用时,Image2插件使用“Div”包装“Figure”标签

喜欢:带有中心alginment的标题小部件

│ center │<wrapper class=”center”>      │<div class=”center”>             │
│        │ <figure />                   │ <figure />                      │
│        │</wrapper>                    │</div>                           |

那么可以用任何其他标签替换这个包装“Div”吗?

1 个答案:

答案 0 :(得分:0)

html代码是我必须关闭的数字..

 <wrapper class="center">
        <figure></figure> 
 </wrapper>

jQuery代码替换了包含中心类的所有包装器标签。

 <script type="text/javascript">
    $("wrapper.center").each(function() {
      $(this).replaceWith( "<div class="+ $( this ).attr('class') +">" + $(this).html() + "</div>" );
    });
 </script>

如果你想只删除一个标签,那么jQuery就是。

 <script type="text/javascript">
     $("wrapper.center").replaceWith( "<div class="+ $( this ).attr('class') +">" + $(this).html() + "</div>" );
 </script>