Like the title says,
I want to be able to, on page load, search through the text located inside #wrapper
.
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: have been working with
<script type="text/javascript">
$(document).ready(function() {
$("#wrapper").html( $("#wrapper").html().replace(/&/g, '<span class="amp">&<"+"/span>') );
});
</script>
this loads with an Error in firebug telling me it isn't a function:
$ is not a function $(document).ready(function() {
Edit: oops forgot to include my reference to jQuery..
this works.
<script type="text/javascript">
$(document).ready(function() {
$("#wrapper").html( $("#wrapper").html().replace(/&/g, '<span class="amp">&<"+"/span>') );
});
</script>