phpjqueryhtmleditornicedit

Remove divs for each sentence inside paragraph


I had used nicEdit for edit my paragraphs and questions etc.With some alignments too.

enter image description here

In the above I had showed you one example. This is single paragraph only. However in the rich text editor by default it will enclose each sentence with a <div>. For one drag and drop issue. I had added css code with

.nicEdit-main div {
  display: inline-block;
}

So that I can drag and drop boxes.Now what is the issue because of my addition of inline-block. If people will try to delete or move forward backwards instead of moving words it's deleting content. What is the solution for this? Thanks in advance.

http://www.nicedit.com/demos.php


Solution

  • Use the below code to remove all divs without class attr inside the element .nicEdit-main

       $('.nicEdit-main div:not([class])').each(function(){
            $(this).contents().unwrap();
        });