0

I have the following table structure:

<table id="tblExample">
    <thead>
        <tr>
            <th>Id</th>
            <th>Val 1</th>
            <th>Val 2</th>
            <th>Val 3</th>
        </tr>
    </thead>
    <tbody>
        <tr id="100">
            <td>1</td>
            <td>1</td>
            <td id="100-1-Some String"></td>
            <td>1</td>
        </tr>
        <tr id="101">
            <td>1</td>
            <td>1</td>
            <td id="101-1-Some String"></td>
            <td>1</td>
        </tr>
        <tr id="102">
            <td>1</td>
            <td>1</td>
            <td id="102-1-Some String"></td>
            <td>1</td>
        </tr>
        <tr id="103">
            <td>1</td>
            <td>1</td>
            <td id="103-1-Some String"></td>
            <td>1</td>
        </tr>
    </tbody>
</table>

What I'm trying to do is to set the value of an specific td dynamically. I'm able to get the td id values that I want. What I've tried so far is the following code:

$('#101#101-1-Some String').html('ABC');

But it's not working. What I saw is that the same code works okay if my id its 101-1-SomeString but the problem is that maybe I'll not be able to change that id. So, my question is if there is a way to access to that id with whitespace?

User1899289003
  • 850
  • 2
  • 21
  • 40
  • Does this answer your question? [jquery IDs with spaces](https://stackoverflow.com/questions/596314/jquery-ids-with-spaces). You should use `$('#101-1-Some\\ String').html('ABC');` or `$('#101 #101-1-Some\\ String').html('ABC');` – kmoser Nov 10 '22 at 04:31

0 Answers0