Leonel Matias Domingos
Leonel Matias Domingos

Reputation: 2064

Jquery selector for table row id

Cant see why cannot find a row by its id besides it exists in table.

var row=$('#tempo_maquina').find('#row_CMIP>A>1900-01-01>A>1900-01-01>1900-01-01');

console.log(row.length);

I've setup a fiddle with the html. https://jsfiddle.net/y7qgt6vy/

Upvotes: 1

Views: 122

Answers (1)

Rory McCrossan
Rory McCrossan

Reputation: 337714

The problem is because the > character is used for the child selector, so you need to escape it for it to be interpreted as part of the id. Try this:

$('#tempo_maquina').find('#row_CMIP\\>A\\>1900-01-01\\>A\\>1900-01-01\\>1900-01-01');

Working example

Alternatively as Pranav points out, you could use the 'attribute equals' selector:

$('#tempo_maquina').find('[id="row_CMIP>A>1900-01-01>A>1900-01-01>1900-01-01"]');

Upvotes: 5

Related Questions