How to select css id's with numbers in them?

What about using the following selector:

input[id^='something_stuff_'][id$='_work']

It will get inputs with id starting with "something_stuff_" and finishing with "_work".


An approach to this problem would be to use classes instead of ids and have things that are styled the same to be classed the same. for example:

<input id="something_stuff_01_work" class="input_class">
<input id="something_stuff_02_work" class="input_class">
<input id="something_stuff_03_work" class="input_class">

Then select the class instead of the id.

.input_class {
    sweetstyleofawesomeness;
}

CSS does not support regexes in selectors. Use classes or starts-from and ends-with attribute selectors.

Tags:

Css