Is it possible to change the wrapping "<div>" of an image in the Image2 ckeditor plugin?
I am using the image2 plugin with CKeditor, I come to a case where I cannot use the "Div" as an image wrapper.
Image2 plugin uses "Div" wrapper on Image tag when Captioned widget is used with central algorithm
Sort of: Caption with centered widgets
│ center │<wrapper class="center"> │<div class="center"> │
│ │ <figure /> │ <figure /> │
│ │</wrapper> │</div> |
So is it possible to replace this "Div" wrapper with any other tag?
+3
source to share
1 answer
The html code should close the shape.
<wrapper class="center">
<figure></figure>
</wrapper>
And the jQuery code replaces all wrapper tags that contain the center class.
<script type="text/javascript">
$("wrapper.center").each(function() {
$(this).replaceWith( "<div class="+ $( this ).attr('class') +">" + $(this).html() + "</div>" );
});
</script>
If you only want to remove one specific tag then jQuery will.
<script type="text/javascript">
$("wrapper.center").replaceWith( "<div class="+ $( this ).attr('class') +">" + $(this).html() + "</div>" );
</script>
0
source to share