×

Welcome to TagMyCode

Please login or create account to add a snippet.
0
0
 
0
Language: Javascript
Posted by: Gary Peach
Added: Feb 24, 2017 8:31 PM
Views: 13
Tags: no tags
  1. $("#container").contents().each(function () {
  2.     if (this.nodeType === 3) this.nodeValue = $.trim($(this).text()).replace(/Hi/g, "Hello")
  3.     if (this.nodeType === 1) $(this).html( $(this).html().replace(/Hi/g, "Hello") )
  4. });