0

Please Guys, I want to run a script which will replace text with an image, either when it's been typed in an input field or it's outputted from the database: here is my code:

<script type="text/javascript" src="jquery.js"></script>
<script>
    ":-)".replace(/\([0-z]+)\/g,"<img src='smiling_face.gif' />");
</script>
KANAYO AUGUSTIN UG
  • 2,078
  • 3
  • 17
  • 31

1 Answers1

1
var container = $('body').html();
test = container.replace(/\:\-\)/g,"<img src='smiling_face.gif' />");
$('body').html(test);
Victor2748
  • 4,149
  • 13
  • 52
  • 89
Dave Meas
  • 156
  • 8