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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 7, 20262026-06-07T06:14:45+00:00 2026-06-07T06:14:45+00:00

So guys, I just want to format a string with jQuery, the string can

  • 0

So guys, I just want to format a string with jQuery, the string can be with closed html tags <div><h2></h2><span></span></div> or without it such as <div><h2></h2><span>, or it may contains images such as <img src=""/>, but I need to format it to have as result only plain text, I suppose that this can be done with a regex, I googled it, but could not find such an example.

So if you could help me, I’ll be very thankful for help. Thanks

An exemple of the string:

<p> 
    <span style="color: rgb(35, 31, 32); font-family: Arial, Helvetica, sans-serif; font-size: 14px; line-height: 20px; ">Преимущества стоматологической установок Anthos</span>
</p> 
<ul class="tech_list" style="margin: 0px; padding-right: 0px; padding-left: 0px; list-style-type: none; color: rgb(35, 31, 32); font-family: Arial, Helvetica, sans-serif; "> 
    <li style="margin: 0px; padding: 8px 0px; font-size: 13px; line-height: 18px; overflow: hidden; border-bottom-width: 1px; border-bottom-style: solid; border-bottom-color: rgb(204, 204, 204); "> 
       <img alt="Anthos " class="photo" src="http
  • 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-07T06:14:46+00:00Added an answer on June 7, 2026 at 6:14 am
    var body;
    
    try {
        body = document.implementation.createHTMLDocument().body;
        //In chrome this avoids requesting images in the html
    }
    catch(e){
        body = document.createElement("body");
    }
    //this doesn't execute css or scripts
    body.innerHTML = '<p> <span style="color: rgb(35, 31, 32); font-family: Arial, Helvetica, sans-serif; font-size: 14px; line-height: 20px; ">Преимущества стоматологической установок Anthos</span></p> <ul class="tech_list" style="margin: 0px; padding-right: 0px; padding-left: 0px; list-style-type: none; color: rgb(35, 31, 32); font-family: Arial, Helvetica, sans-serif; "> <li style="margin: 0px; padding: 8px 0px; font-size: 13px; line-height: 18px; overflow: hidden; border-bottom-width: 1px; border-bottom-style: solid; border-bottom-color: rgb(204, 204, 204); "> <img alt="Anthos " class="photo" src="http'
    
    console.log( $(body).text() );
    //Преимущества стоматологической установок Anthos  
    

    demo http://jsfiddle.net/FvBzX/

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

Sidebar

Related Questions

hey guys, i just want to ask if the jquery file tree plugin is
Hi guys I'm a jquery noobie, just started jqueryUI Problem OverView: I'm trying to
Hey guys, I have a CS exam tomorrow. Just want to get a few
I guys, isn't present databound event on asp repeater server control? I just want
Hello Guys! Using firefox plugins I can capture headers. I want to do it
Hello guys, just want you to ask something about my code... I have 5
Just want to know how do you guys provide this files for the users.
Ok guys, three questions here. They are all pretty noobish, but I just want
hey guys just a quick one for tonight. i just want to change a
I just want to see what you guys might think the difference (in terms

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.