jquery - How to properly use multiple :not selectors using variables -


i have these 3 variables , , need use 3 in :not selector

  var donotcounts = 'td.player:contains(s)';     var donotcounti = 'td.player:contains(i)';     var donotcounto = 'td.player:contains(o)';   

here have snippet of script , have 1 variable working fine, when add 2nd or 3rd doesn't work

if ($(this).find("td.player:not("+donotcounts+")").length 

i have tried these , none have worked

if ($(this).find("td.player:not("+donotcounts+"):not("+donotcounti+"):not("+donotcounto+")").length if ($(this).find("td.player:not("+donotcounts+"),("+donotcounti+"),("+donotcounto+")").length if ($(this).find("td.player:not("+donotcounts+","+donotcounti+","+donotcounto+")").length 

also , on note.....currently variables td.player:contains() , more specific. how can write , td.player hasclass span , contains() ?

to select elements contain class inside selector, can use attribute contains word selector , combine :not want, example:

var donotcountclasstest = "[class~='test']"; 

you can play minimal example:

https://jsfiddle.net/lmgonzalves/zqu3eqfm/12/


Comments

Popular posts from this blog

c# - Validate object ID from GET to POST -

node.js - Custom Model Validator SailsJS -

php - Find a regex to take part of Email -