Kavya Shree Kavya Shree - 6 months ago
649 0

Hiiii Everyone,

I have a Rich text Editor(using nicEditor).I want to enclose each word with span .What I want is After adding some text in richtext Editor I wanna change it will The similarly for all words inside paragraph.I tried like above but Its return object.What is the issue? Please anyone help me.Thanks in advance.Im struggling for this issue longtime please anyone help me

jQuery

Add Span for each Word in nicEditor Jquery

var myInstance1 = new nicEditor({
    iconsPath: 'https://cdn.jsdelivr.net/nicedit/0.9r24/nicEditorIcons.gif'
  }).panelInstance('differ_paragraph'); 
myInstance1.addEvent('blur', function() { 
var text1 = this.instanceById('differ_paragraph').getContent(); 
var nicInstance1 = nicEditors.findEditor('differ_paragraph');
 var words =  nicInstance1.getContent().split(" ");
nicEditors.findEditor("differ_paragraph").setContent(' ');
$.each(words, function(i, v) {
    nicEditors.findEditor("differ_paragraph").setContent($("<span>").text(v));
});

});