Reputation: 337
Its a fairly small script, but for some reasons im not able to get it working. this is the function
function stffsort(n) {
$("[data-stff=" + n + "]").removeClass("hidden");
$("[data-stff!=" + n + "]").addClass("hidden");
}
however, this piece here $("[data-stff!=" + n + "]")
returns the whole page elements.
Upvotes: 0
Views: 41
Reputation: 2914
however, this piece here $("[data-stff!=" + n + "]") returns the whole page elements.
Yes; it would return everything that doesn't have a data-stff
set to that value, including things that don't have a data-stff
attribute at all.
Try [data-stff][data-stff!=" + n + "]"
and see if that gets you what you're after.
Upvotes: 1
Reputation: 33738
This kind of selector requires the value to be in double-quote marks:
$('[data-stuff!="' + n + '"]')
Upvotes: 0