How to customize an image using a specific src path using jQuery

How can I target the img file below using the src file?

<img src="left1.gif" alt="" /> 

$('img[src=left1.gif]').hide(); does not work

+4
source share
2 answers

You need to put quotes around the string src value in your selector. This helps eliminate ambiguities with special characters and seems to apply to . in the file name.

 $("img[src='left1.gif']").hide(); 
+6
source

Your HTML says l e ft1.gif, but your jQuery says l i ft1.gif. Also note the quotes around my value:

 $("img[src='left1.gif']").hide(); 
+4
source

All Articles