18

I am attempting to set a style for all the input elements that does not contain a class that begins with "border-radius":

input:not(class^="border-radius") {

This is not working. Any other ideas?

fercaveri
  • 75
  • 1
  • 11
MultiDev
  • 9,921
  • 23
  • 74
  • 141
  • 2
    Possible duplicate of [Can I write a CSS selector selecting elements NOT having a certain class?](http://stackoverflow.com/questions/9110300/can-i-write-a-css-selector-selecting-elements-not-having-a-certain-class) – James Waddington May 26 '16 at 16:23

4 Answers4

38

Check Your Syntax

Ensure that your class attribute selector is contained within square braces to avoid any syntax issues.:

input:not([class^="border-radius"]) {
   /* Your style here */
}

Handling Multiple Classes

Additionally, if you expect to contain multiple classes, you might want to consider using the contains selector *= instead as the previous approach will only work if the first class attribute starts with "border-radius" :

input:not([class*="border-radius"]) {
   /* Your style here */
}

Examples

This is an example demonstrating the starts-with ^= selector.

enter image description here

input { margin: 10px}

input:not([class^="border-radius"]) {
  background: yellow;
}
<input class='border-radius' />
<input class='normal' />
<input class='test border-radius' />
<input class='another-normal' />
<input class='border-radius-5' />

This is an example demonstrating the contains *= selector.

enter image description here

input { margin: 10px}

input:not([class*="border-radius"]) {
  background: yellow;
}
<input class='border-radius' />
<input class='normal' />
<input class='test border-radius' />
<input class='another-normal' />
<input class='border-radius-5' />
Rion Williams
  • 72,294
  • 36
  • 192
  • 318
4

Try input:not([class^="border-radius"]) instead. Attribute selectors are written inside square brackets [].

input:not([class^="border-radius"]) {
  background: blue;
}
<input type="text">
<input type="text" class='border-radius'>
<input type="text" class='border-radius-something'>
Nenad Vracar
  • 111,264
  • 15
  • 131
  • 153
-1

You need to update your selector to this:

input:not(.border-radius)
kiaaanabal
  • 346
  • 2
  • 12
-2

try this in javascript

this.el.on('click', 'ul.pagination li:not(.disabled,.active)', function ....
Basheer AL-MOMANI
  • 13,431
  • 9
  • 89
  • 88