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
  • 1,877
  • 1
  • 14
  • 27

1 Answers1

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