How do jquery and javascript assign the contents of one element to another
<span style="font-size:24px;"></span>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"><html xmlns="http://www.w3.org/1999/xhtml"><head><meta http-equiv="Content-Type" content="text/html; charset=utf-8" /><title> Headless document </title></head><script src="jquery-1.9.0.min.js"></script><script>$(document).ready(function(){a=$("#p1")[0].innerText;$("#p2")[0].innerHTML=a;})</script><script>window.onload=function(){a=document.getElementById("p1").innerText;document.getElementById("p2").innerHTML=a;}</script><body><p id="p1" name=" This is the title right now "> This is the title right now </p><p id="p2" name=" This is a title, "> This is a title, </p></body></html>