How would I go about targeting the below img with the src file?
<img src="left1.gif" alt="" />
$('img[src=left1.gif]').hide();
doesn't work
You need to put quotes around the string value of src in your selector. This helps resolves ambiguities with special characters, and seems to apply to the .
in the filename.
$("img[src='left1.gif']").hide();
Your HTML says left1.gif, but your jQuery says lift1.gif. Note also the quotes around my value:
$("img[src='left1.gif']").hide();
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