I'm trying to select a data attributes value that has a space or a certain character in it but it doesn't like it very much. Below is the code that I have working for one worded attribute values.
$('div[data-roomtype='+$(this).data('roomtype')+']').animate({opacity:0.1},100);
And I have also put together a very simplified fiddle (http://jsfiddle.net/Tse6k/2/) of what I'm hoping to achieve. Is there an easy solution to this? Any help or advice would be much appreciated.
Quote the value in the selector:
// ------------------v -------------------------------v
$('div[data-roomtype="' + $(this).data('roomtype') + '"]'). ...
DEMO: http://jsfiddle.net/Tse6k/3/
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With