24.12.10

Reemplazar texto con JQuery

Código:

$(document).ready(function(){
    $('body').html(         $('body').html().replace(/Viva/ig, "<strong>MOLA</strong>")    );
});

Fuente: www.bufa.es



También

<script type="text/javascript">
(function($) {
  var thePage = $("body");
  thePage.html(thePage.html().replace(/jQuery/ig, '<a href="http://jquery.com">jQuery</a>')); 
})(jQuery)
</script>

1 comentario :

Sentite libre de comentar, criticar y/o aportar tu granito en este (proyecto de..) mar de conocimiento ;)