Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8677373
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 12, 20262026-06-12T20:26:26+00:00 2026-06-12T20:26:26+00:00

In my application, in insert news section, i use a sub string of news

  • 0

In my application, in insert news section, i use a sub string of news content for news Summary. for getting news content text from users,i use CKEditor and for news summary i use substring method to get a certain length of news content.but when i’m working with CKEditor i get text with html tags and not plain text and when i use substring method, my news summary become messed! how do i get raw text from this control?
i read this but i can’t use getText() method

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-12T20:26:27+00:00Added an answer on June 12, 2026 at 8:26 pm

    do it like this

    //getSnapshot() retrieves the "raw" HTML, without tabs, linebreaks etc
    var html=CKEDITOR.instances.YOUR_TEXTAREA_ID.getSnapshot();
    var dom=document.createElement("DIV");
    dom.innerHTML=html;
    var plain_text=(dom.textContent || dom.innerText);
    
    alert(plain_text);
    

    viola, grab the portion of plain_text you want.

    UPDATE / EXAMPLE

    add this javascript

    <script type="text/javascript">
    function createTextSnippet() {
        //example as before, replace YOUR_TEXTAREA_ID
        var html=CKEDITOR.instances.YOUR_TEXTAREA_ID.getSnapshot();
        var dom=document.createElement("DIV");
        dom.innerHTML=html;
        var plain_text=(dom.textContent || dom.innerText);
    
        //create and set a 128 char snippet to the hidden form field
        var snippet=plain_text.substr(0,127);
        document.getElementById("hidden_snippet").value=snippet;
    
        //return true, ok to submit the form
        return true;
    }
    </script>
    

    in your HTML, add createTextSnippet as onsubmit-handler to the form, eg

    <form action="xxx" method="xxx" onsubmit="createTextSnippet();" />
    

    inside the form, between <form> and </form> insert

    <input type="hidden" name="hidden_snippet" id="hidden_snippet" value="" />
    

    When the form is submitted, you can serverside access hidden_snippet along with the rest of the fields in the form.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm building an application that needs to allow a user to insert text from
I have an application where I need to INSERT an auto_increment value from a
I am creating windows application to insert data from Excel file into database. My
I'm trying to insert values from my asp.net application into my MySQL database. On
Insert the data to the current application database from the another application database. Any
I'm hoping to use the following update\insert method to speed up my application insert\updates:
I would like that the users of my application can insert an hour of
I am working on a console application to insert data to a MS SQL
I created MVC ASP.Net Web application and tried insert Thai language data to SQL
i have written insert query for my application to create new user with password,

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.