Select div using wildcard ID

前端 未结 9 1763
旧时难觅i
旧时难觅i 2020-11-29 11:30

How to select a div using it\'s ID but with a widcard?

If the DIV\'s ID is statusMessage_1098, I would like to select it in some way like document

9条回答
  •  春和景丽
    2020-11-29 11:51

    Usual way to do this within css is to give the elements a class 'statusMessage' in addition to their unique ids. Then you can create a css rule with a selector that will affect all elements with that class. Eg

     .statusMessage {color: red;}
    

    Remember that elements can have more than one class. Eg

提交回复
热议问题