Link to home
Start Free TrialLog in
Avatar of Luv2Muff
Luv2Muff

asked on

Scan page and replace text

Hi,

Hoping someone can help with this.

First I want to look up the text contained in <meta name="keywords" content="FOO" />

Then I want to replace all instances in the page of the text "XXXX" with above.

So for example:

"This is the XXXX page text"

will become:

"This is the FOO page text"

Is this possible?


ASKER CERTIFIED SOLUTION
Avatar of Hugh McCurdy
Hugh McCurdy
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of irocwebs
irocwebs

<script>
$(function(){
var keywords = $('meta[name=keywords]').attr("content");
$(document).ready(function(){  
      $('.replaceme').replaceWith(keywords);
      });
});
</script>

This is the <span class="replaceme">XXXX</span> page text
Avatar of Luv2Muff

ASKER

Thanks