last day (15 days later) » 

5:25 AM
0
A: CKEDITOR : Find Text and Put Span tag around the Text

Muhammad Omer AslamCKEDITOR.instances.editor1.window.getFrame().$ retrieves a native DOM element for editor editable area. So: $( CKEDITOR.instances.editor1.window.getFrame().$ ).contents().find( yourelement); Or if you want to find a specific text then $( CKEDITOR.instances.editor1.window.getFrame().$ ).cont...

 
But,i need to find the Text inside the Element
 
there is a :contains selector you can use with jquery, see here api.jquery.com/contains-selector , for example $( CKEDITOR.instances.editor1.window.getFrame().$ ).contents().find( 'span:conatins("your-text")');
 
Ok ,i will try and i also posted that image that you needed now.Please refer this.I am trying your code in console.
 
I am confident it should work out for you.
 
I'm trying the above thing but it gives the below Error. Uncaught Error: Syntax error, unrecognized expression: unsupported pseudo: conatins at Function.Sizzle.error (jquery-3.2.1.js:1580) at PSEUDO (jquery-3.2.1.js:1927).Do you want the screen shot for this.
 
5:25 AM
we are almost there do you have a live link that i could see ?
 
Kk ,wait a minute i will create a link for you.
Hi,muhammad here is the link jsfiddle.net/5my9w/190
 
i just noticed the error you posted has a spelling mistake it should be contains rather than conatins can you verify it
hi Mari
 
contains kk wait a miute
I try that thing to find
 
sure take your time you
 
Sorry for the inappropriate message
 
5:31 AM
:) no worries friend
 
I tried $( CKEDITOR.instances.editor1.window.getFrame().$ ).contents().find( 'p:contains("Aerobic")');
It give me inner html like this "<span data-bkmark="18_5003_Story9_p_2_X_60_Y_171_C_1"></span>Normal and Abnormal Responses to Acute A<span>erob</span>ic Exercise<span data-bkmark="18_5003_Story9_p_2_X_60_Y_171_C_1"></span>"
But i want to find only Aerobic and put a span around that thing.Can you help me friend :)
 
that is because the text is formatted inside the editor and editor uses tags to underline or make bold , can you view source and paste here for the editor , there is a source button in the editor click it and copy all the html inside the editor
if that is the case then you are gonna get the text in the same manner unless it is an unformatted text inside any p , span or div tag
 
You want me to put that thing into jsfiddle
 
no just paste here
 
Yes i will and i also try span and div
Full para of html content
 
5:38 AM
just want to verify if the actual code inside the editor is disp[layed in the same way
just click Source button and copy everything inside editor
and paste here
in the chat window
just like this
 
<p class="ChapterTitle" data-name="ChapterTitle" id="sampleText" data-split="d1e48" style="margin-right:36pt">Impaired add A<span class="bold">erobi</span>c add Capacity/Endurance add</p>
This is cksource
 
hmm i was right
the text is pre-formatted
 
I'm neglecting all unwanted things when ckeditor loaded
KK can we do that.
I'm worried about that problem
Because i need to complete today.
 
hmm , cant do much about it
maybe someone else could help you out
lets wait , and if i find anything meantime would add a comment there
 
6:08 AM
Thank you.I will try at my end also.Thank's for your time also.
 

last day (15 days later) »