slandau
slandau

Reputation: 24052

hide all td's with same id with jquery

<td id="valhisprofitVal"><%= Math.Round(profit, 5) %>%</td>

These rows are added dynamically, so there can be multiple rows with the same Id.

How do I hide all of them using Jquery?

Upvotes: 1

Views: 2585

Answers (1)

BoltClock
BoltClock

Reputation: 723618

You can't. Only one element can have its own ID, you can't share the same ID among multiple elements. And because of that, if you try to use JavaScript to find elements with the same ID, you'll only obtain the first of those elements.

Use a class instead:

<td class="valhisprofitVal"><%= Math.Round(profit, 5) %>%</td>

Then in jQuery, select the class:

$('.valhisprofitVal').hide();

Upvotes: 13

Related Questions