Tuesday, 10 September 2013

How do I make jQuery change the DOM on another webpage in my domain?

How do I make jQuery change the DOM on another webpage in my domain?

I can't figure out how to use jQuery on the webpage I'm on to make changes
to another webpage's html in my domain. Suppose I want to change the
following at mydomain.com/changedom.html:
<body>
<p id="changehere">This is the text I want to bold.</p>
</body>
and I'm in mydomain.com/index.html and I want to run jQuery to change the
previous page as below:
<script type="text/javascript"
src="https://ajax.googleapis.com/ajax/libs/jquery/1.7.1/jquery.min.js">
</script>
<script type="text/javascript">
$(document).ready(function() {
$('http://www.mydomain.com/changedom.html p#changehere').html(<b>This is
the text I want to bold.</b>');
});
</script>
doesn't work for me. Help!

No comments:

Post a Comment