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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 28, 20262026-05-28T20:32:33+00:00 2026-05-28T20:32:33+00:00

I have the following HTML; <p class=postcontent> <img src=#> Some Text </p> I want

  • 0

I have the following HTML;

<p class="postcontent">
<img src="#">
Some Text
</p>

I want to be able to hide only the text.
So far I have this;

  jQuery(function($) {
$(".postcontent").$('[type=text]').hide();
  });

Edit: I don’t have any control over the html so I need to add it by Jquery.

  • 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-28T20:32:34+00:00Added an answer on May 28, 2026 at 8:32 pm

    You can wrap the text on the FLY and then hide it:

    HTML:

    <p class='postcontent'> <a href=#> dsds </a> aaa </p>
    

    Javascript:

    $('.postcontent').contents().filter(function() {
         return this.nodeType == 3; })
                 .wrap('<label"> <label />').parent().hide();
    

    JSFiddle


    Update based on a comment:
    Why does it create two labels? that’s easy because it has two text nodes…:

    <p class='postcontent'> (!!FirstTextNode!!)
        <a href=#> dsds </a> (!!SecondTextNode!!) aaa 
    </p>    
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Suppose I have the following html: This a test of <code>some code</code>. <div class='highlight'>
I have following HTML <tr id=r1 class=l1> <td><img class=plusminus id=r1c1 src=assets/images/plus.png border=0 />3/10/12</td> <td></td>
I have the following html structure: <div class=divClass> <a class=aClass href=#> <img src=xxxx.jpg <span
I have following generrated HTML, and I want to add some CSS class to
I have the following HTML: <div class=item> <img src=http://mintywhite.com/images/wg/0904/05rssfeedicons/rss-feed-icons11.jpg/> TEXT NODE <span class=some_class>What the
I have the following HTML markup. <div class=caption> <img class='active' alt='My Caption' src='path/to/image' />
So I have some html that looks like the following: <div class='something unknown' id='something_unknown_1'>
I have the following html that I am trying to modify: <div class=col1 width8><img
I have the following HTML: <div class=wrapper> <div class=label> foor bar baz </div> <img
I have the following HTML (a snippet): <td class=ms-vb-title height=100%> <table class=ms-unselectedtitle onmouseover=OnItem(this) ctxname=ctx1

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.