Başlık diyor gibi
Ben, sayfa yük, #wrapper
içinde bulunan metin üzerinden arama yapabilmek istiyorum.
If there is a "&
" I want it to have a span
tag applied to it and a class appended to that span
.
Ie:
if it finds "hello & Welcome
"
it should end up like "hello <span class="amp">&</span> Welcome
".
I did have some code Ive been trying but all didn't work, so pointless to include it. Any help would be great guys thanks.
EDIT: ile çalışıyoruz
<script type="text/javascript">
$(document).ready(function() {
$("#wrapper").html( $("#wrapper").html().replace(/&/g, '<span class="amp">&<"+"/span>') );
});
</script>
Bu bir işlev değil, bana kundakçı bir hata ile yükler:
$ is not a function $(document).ready(function() {
Edit: ayyy jQuery benim referans eklemeyi unutmuşum ..
Bu çalışıyor.
<script type="text/javascript">
$(document).ready(function() {
$("#wrapper").html( $("#wrapper").html().replace(/&/g, '<span class="amp">&<"+"/span>') );
});
</script>