-1

I need to style this div:

<div id="standings-@pool.PoolId"></div>

How do I select all of those divs with a different id at once ?

Bhuwan
  • 16,525
  • 5
  • 34
  • 57

1 Answers1

0

If in your id standings substring is fixed, you can use css selectors for this like

div[id^="standings"]

It wii selects all elements with a id attribute containing the word "standings"

Stack Snippet

div {
  width: 200px;
  height: 50px;
  margin-bottom: 10px;
  font: 13px Verdana;
  line-height: 50px;
  text-align: center;
}

div[id^="standings"] {
  border: 1px solid #000000;
}
<div id="standings-@pool.1">1</div>
<div id="standings-@pool.2">2</div>
<div>3</div>
<div id="standings-@pool.4">4</div>
<div id="standings-@pool.5">5</div>
<div id="standings-@pool.6">6</div>
Bhuwan
  • 16,525
  • 5
  • 34
  • 57
  • 1
    This will match every id attribute that contains "standings", not just the ones that start with it. – str Jan 22 '18 at 13:55
  • @str Agreed...Actually it depend upon the OPs requirement...Updated! – Bhuwan Jan 22 '18 at 14:00
  • @BhuwanBhatt Please do read the comments to a question before answering. This was not only answered by a comment 20 minutes before your answer, it was also a duplicate. – mplungjan Jan 22 '18 at 14:55