1

In html you can apply multiple css classes to a object e.g class="a b c". In jquery its nice and handy to work with all elements with these classes e.g.

jQuery('.b').hide();

In Html 5 using custom attributes, jQuery seems to recognise multiple values e.g. dataset="a b c" as abc i.e. selectable through:

jQuery('tr[dataset="a b c"]').hide();

but

jQuery('tr[dataset="a"]').hide();

does not select any elements with dataset="a b c"

Obviously i can think of two/three work arounds but is there a way for jQuery to recognise multiple values in a custom attr?

1 Answer 1

2

I think the Attribute Contains Word Selector will do what you are looking for: jQuery('tr[dataset~="a"]').hide();

Update: Here is a simple example fiddle

Sign up to request clarification or add additional context in comments.

2 Comments

For more up-votes, add a jsfiddle, pen, or code snippet.
nice and simple one :)

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.