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

  • Home
  • SEARCH
  • 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 8261685
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 8, 20262026-06-08T03:29:46+00:00 2026-06-08T03:29:46+00:00

My html is: <div> Some text <span>label text</span> </div> Jquery: ?? I want output

  • 0

My html is:

<div>
   Some text
   <span>label text</span>
</div>

Jquery:

??

I want output printed as –

"Some text"

When I do $("div").text(), I get Some textLabel text
and when I do $("div").html(), I get Some text<span>Label text</span>

  • 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-08T03:29:48+00:00Added an answer on June 8, 2026 at 3:29 am

    Try this plz:

    Working demo http://jsfiddle.net/f8VFf/ you can also look for innerHTMl and outterHTML

    jQuery.fn.justtext = function() {
    
        return $(this).clone()
                .children()
                .remove()
                .end()
                .text();
    
    };
    alert($('div').justtext());​
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have the following HTML <div> <label for=username>Username:</label> <input type=text name=username id=username /> <span>some
In a DIV I place some text/html code which get loaded from a database.
Given this HTML: <div class=OpenIDSelector>some text</div> Why does this JQuery selector match it on
Say I have the following HTML: <div> <span>span text</span> div text <span>some more text</span>
I've got some html that looks like this: <div> <span class=red>red text</span> some more
I have some HTML setup like this: <div> <label for=amount><a id=amount-help-icon class=help icon-link href=#><span
I have the following html <div class=someClass> Some text </div> <div class=someClass> Some other
I have a jquery line of code that outputs some HTML to a div.
I have some html like the following: <div class=control-group> <input type=text data-bind=value: $data.DealCode name=DealCode
I have some HTML: <div align=center style=border:1px solid red> This is some text in

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.