Dušan
Dušan

Reputation: 498

jQuery selector for HTML5 data attributes

I have this button with multiple data attributes, and i want to hide it by selecting it based on class and two data attributes.

<a href='#' class='wishlist-icon' data-wish-name='product' data-wish-url='/product'>Button</a>

$(".wishlist-icon [data-wish-name='product'] [data-wish-url='/product']").hide();

I don't know why this selector doesn't work.

DEMO

Upvotes: 3

Views: 5673

Answers (1)

Sachin
Sachin

Reputation: 40970

Just remove the space between the selector.

$(".wishlist-icon[data-wish-name='product'][data-wish-url='/product']").hide();

Js Fiddle Demo

Upvotes: 7

Related Questions