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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 30, 20262026-05-30T08:03:08+00:00 2026-05-30T08:03:08+00:00

Inspired from the post JQuery changing content of table cell , I am trying

  • 0

Inspired from the post JQuery changing content of table cell , I am trying to modify the content of table cells containing a particular string which includes non breaking white spaces   or equivalently  , but I can’t seem to make it work in my case.

Html code:

    <table id='table1'>
      <tr>
         <td>&nbsp;a</td>
         <td>b</td>
      </tr>
    </table>​

JQuery:

  $("#table1 td:contains('&nbsp;a')").html("hallo");

It has no effect.

Another question: Is there a selector stricter than contains, selecting only the cells with exactly a given string?

  • 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-30T08:03:10+00:00Added an answer on May 30, 2026 at 8:03 am

    If you use .filter(), you can select elements based on any custom criteria you want.

    $('#table1 td').filter(function()
    {
        return $(this).html().indexOf('&nbsp;a') !== -1;
    
    }).html('hallo');
    

    or to answer your other question:

    $('#table1 td').filter(function()
    {
        return $(this).html() === '&nbsp;a';
    
    }).html('hallo');
    

    This is a lot more robust than writing convoluted selector strings.

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

Sidebar

Related Questions

I have the following jQuery script which hides/expands row in table: it was inspired
Inspired from the other topic , I wrote this code which simulates a finally
I have a problem when compiling my app, which is inspired from bitmap-plasma. I
This is more a conceptual question. It's inspired from using some extremely large table
About a year ago I wrote a jQuery-inspired library which allowed you to manipulate
This question is inspired from another topic which poses this question: Find the first
I have a question on the data.table idiom for non-joins, inspired from Iterator's question
Consider the JavaScript code below, inspired from the YUI documentation on YAHOO.lang.extend . In
This is inspired by/taken from this thread: http://www.allegro.cc/forums/thread/603383 The Problem Assume the user gives
This is inspired by Does File.Copy() from a network share to another share on

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.