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 954065
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 16, 20262026-05-16T00:09:07+00:00 2026-05-16T00:09:07+00:00

I have an HTML form with a few fields. One of them is a

  • 0

I have an HTML form with a few fields. One of them is a textarea managed by CKEditor.

When the user wants to submit the form, I want to check whether he entered values in all the fields.

I know how I can check if CKEditor control has anything in it, but it could be “empty” HTML tags without any text in it.

How do I check for text?

Server side I’m using something like PHP’s trim(strip_tags($content)), so I’d like to have the same in JavaScript.

A solution using jQuery would also be usable.

  • 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-05-16T00:09:08+00:00Added an answer on May 16, 2026 at 12:09 am

    This will work:

    $("#editorContainer iframe").contents().find("body").text();
    

    That will contain only the text, and none of the html tags.

    UPDATE

    It definitely works on the CKEditor demo page. Use Firefox and Firebug, go to the Firebug console, and type in:

    $("#demoInside iframe").contents().find("body").text();
    

    The console will print out the text in the editor, with no html tags. Make sure you have the selector correct in your particular application. You can test your selector like this:

    $("#demoInside iframe").contents().find("body").length;
    

    That should equal 1. If it’s 0, your selector is wrong.

    UPDATE 2

    Again, my code is still correct, and it still works on that page. You just need the right selector. On the page you linked to, it is a <span> with id cke_editor1. That particular page does not make use of jQuery, so it requires some additional work to prove this sample works. Install FireQuery, “jqueryify” the page, and then do this in the Firebug console (note you have to use jQuery and not $. That’s how FireQuery works).

    jQuery("#cke_editor1 iframe").contents().find("body").text();
    

    In short, make sure you have the right selector to get to your iframe. Whether you create your CKEditor from a <div> or a <textarea> is not important. As long as you can select the <iframe> that CKEditor injects into the DOM, you can use .contents().find("body").text() to get the text of that iframe. Have you tested your jquery selector to see if .length == 1?

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

Sidebar

Related Questions

I have a registration form with a few fields. One of them looks like
I have a form with a few fields, one of which should be updated
I have an HTML form where the user can type in any number:5, 8,
I have a HTML form with fields such as name, address, notes, etc. I
I will have a web-application which will use a few complex forms. One form
I have a php form and I want to display or hide certain fields
I have simple form. It contains few texboxes and one dropdown list. And I
I have a following problem, I have HTML form that uploads a file with
My input tag started to go crazy... I have html form for input to
I have a html form for uploading a file, which is as follows: $uploadhtml

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.