2

I am having trouble accessing a div element within a table.

// All within document ready ...

$('.ChangeStatus').click(function()
{
    $('#status_display:100').html('Updated');   

});

Here is the HTML

<td>
     <div class="status_display" id="status_display:100">
          open<br/>
          <a href="#" class="ChangeStatus" id="close:100">Close lead</a>
     </div>
</td>

WHen I click the anchor it says the html of the div is null before and after I try to set the html.

Thanks in advance!

dnaluz
  • 135
  • 1
  • 10

2 Answers2

8

The : character is a special character in jquery selectors which needs to be escaped.

Try this $('#status_display\\:100').html('Updated');

PetersenDidIt
  • 25,562
  • 3
  • 67
  • 72
2

jQuery has problems with IDs that contain colons:

Related question

Community
  • 1
  • 1
Plynx
  • 11,341
  • 3
  • 32
  • 33