I have a little problem - i want to replace the characters "K" and "k" against images in a H1 Element.
I've tried this and it works pretty nice for one character:
$(function() {
$("h1").each(function() {
if($(this).children().length==0) {
$(this).html($(this).text().replace('K', '<img src="http://www.fotograf-in-frankfurt.biz/img/v2013/k_cap.png" style="display:inline-block;" alt="K">'));
}
});
});
This one worked pretty well for the capital "K", but now I allso want to replace the lower one - so I tried this:
$(function() {
$("h1").each(function() {
if($(this).children().length==0) {
$(this).html($(this).text().replace('K', '<img src="http://www.fotograf-in-frankfurt.biz/img/v2013/k_cap.png" style="display:inline-block;" alt="K">').replace('k', '<img src="http://www.fotograf-in-frankfurt.biz/img/v2013/k_low.png" style="display:inline-block;" alt="k">'));
}
});
});
The result finaly looked a little creepy - something like this:
furt.biz/img/v2013/k_cap.png" style="display:inline-block;" alt="K">ontakt & Terminvereinbarung
But it should more look like this with replaced characters:
Kontakt & Terminvereinbarung
I'm pretty sure i've made a mistake, an idiotic maybe, but where?
Thanks a lot for your help!