Hi I got in a bit of a muddle here. Basically say you have this html:
...
<a href="javascript:void(0)">
<img alt="" data-name="myCar" data-family="ferrari" data-type="Fast Family" src="images/ferrari.png" style="left: 193.291px; opacity: 0.5; cursor: default;">
</a>
<a href="javascript:void(0)">
<img alt="" data-name="yourCar" data-family="aston" data-type="Fast Family" src="images/aston.png" style="left: 293.291px; opacity: 0.5; cursor: default;">
</a>
...
In my script, there is a variable$allImages = $("a img");
containing all the images and I want to select exactly the element whose data-name attribute value is myCar and find its position - mind there are many more cars in the list.
So what I have tried first is this:var theCar = $allImages.attr('[data-name="myCar"]').css('left');
and thenvar theCar = $allImages.data('name')=="myCar".css('left');
but I think the syntax is wrong; how do I select it please?
thanks