javascript - Replace multiple occurrences of words in html of page -


how can replace words in html without losing event bindings ?

i want replace occurrences of word 'delivery' 'pickup' on html page

suggested approaches :

  1. get html of page , store in variable 'content'
  2. replace word in 'content' variable through regex (updated_content = content.replace(/delivery/ig,'pickup'));
  3. update page html updated_content

but approach wipes out event binding on page

if use jquery:

$("*:not(html, table, tbody, tr):contains('" + yoursearchphrase + "')").each(function(index, item) {   item.innertext = item.innertext.replace(yoursearchphrase, replacementtext); }); 

Comments

Popular posts from this blog

python - How to insert QWidgets in the middle of a Layout? -

python - serve multiple gunicorn django instances under nginx ubuntu -

module - Prestashop displayPaymentReturn hook url -