The jquery below changes the src value to whatever I specify, however this gets applied to all tags.
$("img").attr({src: "/_layouts/images/Flags_Germany_resized.png"});
I have tags which do have an id, for this reason I would like to know how to select an specific tag by using its title rather than id.
The img tags for which I would like to change the src value are as follows:
<img title="Folder: Germany" alt="Folder: Germany" src="/_layouts/images/folder.gif"
border="0" complete="complete"/>
<img title="Folder: Angola" alt="Folder: Angola" src="/_layouts/images/folder.gif"
border="0" complete="complete"/>
<img title="Folder: Russia" alt="Folder:Russia" src="/_layouts/images/folder.gif"
border="0" complete="complete"/>
Any suggestions or assistance will be appreciated.
Thanks in advance
Use the attribute selector:
$('img[title="Folder: Germany"]').attr({src: "/_layouts/images/Flags_Germany_resized.png"});
Docs: http://api.jquery.com/category/selectors/attribute-selectors/