26

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?

ggorlen
  • 44,755
  • 7
  • 76
  • 106
MultiDev
  • 10,389
  • 24
  • 81
  • 148
  • 3
    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

50

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
  • 74,820
  • 37
  • 200
  • 327
5

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
  • 118,580
  • 15
  • 151
  • 176
2

You need to update your selector to this:

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

try this in javascript

this.el.on('click', 'ul.pagination li:not(.disabled,.active)', function ....
Basheer AL-MOMANI
  • 14,473
  • 9
  • 96
  • 92