A couple of suggestions to improve this (besides fixing the bug).
- Use ' instead of " in the string: Javascript is happy with both, but would make reading the string a lot easier.
- How about adding a class on the <img> or <a> tag and define the string in the CSS file? It seems it would be more flexible.

If you rather to these later or in a different commit, let me know and I will merge this one as is.