A03reserved<...">

JQuery - How to select elements that do not have a class?

How to get elements that don't have class names?

        <td class="B A">A03<sub>reserved</sub></td>
        <td class="B R">R70</td>
        <td>105</td>
        <td class="M C">L220</td>

I'm doing it now $('td').not('.A, .B, .C, .M, .R')

There must be a better way!

+3
source share
3 answers

You can use an attribute selector with an empty value:

$('[class=]')
+12
source

how about this:

$("td:not([class])")

not sure if this will work for something like:

<td class="">
+7
source

One way to do this is to use filter():

$("td").filter( function() {return this.className=='';} )
0
source

Source: https://habr.com/ru/post/1740814/


All Articles