{"id":72,"date":"2009-08-26T08:42:24","date_gmt":"2009-08-26T08:42:24","guid":{"rendered":"http:\/\/www.adriangrigoras.com\/blog\/?p=72"},"modified":"2009-08-26T08:42:24","modified_gmt":"2009-08-26T08:42:24","slug":"insert-html-code-into-a-div-using-jquery","status":"publish","type":"post","link":"https:\/\/adriangrigoras.com\/blog\/insert-html-code-into-a-div-using-jquery\/","title":{"rendered":"Insert html code into a div using JQuery"},"content":{"rendered":"<p>When you want to insert a certain HTML code into one DIV you can use the following html code:<\/p>\n<blockquote>\n<address>\n<div id=\"_mcePaste\" style=\"position: absolute; left: -10000px; top: 0px; width: 1px; height: 1px; overflow-x: hidden; overflow-y: hidden;\">html&gt;<\/div>\n<div id=\"_mcePaste\" style=\"position: absolute; left: -10000px; top: 0px; width: 1px; height: 1px; overflow-x: hidden; overflow-y: hidden;\">&lt;head&gt;<\/div>\n<div id=\"_mcePaste\" style=\"position: absolute; left: -10000px; top: 0px; width: 1px; height: 1px; overflow-x: hidden; overflow-y: hidden;\"><span style=\"white-space: pre;\"> <\/span>&lt;title&gt;Header&amp;Footer import&lt;\/title&gt;<\/div>\n<div id=\"_mcePaste\" style=\"position: absolute; left: -10000px; top: 0px; width: 1px; height: 1px; overflow-x: hidden; overflow-y: hidden;\"><span style=\"white-space: pre;\"> <\/span>&lt;script src=&#8221;jquery-latest.js&#8221; type=&#8221;text\/javascript&#8221;&gt;&lt;\/script&gt;<\/div>\n<div id=\"_mcePaste\" style=\"position: absolute; left: -10000px; top: 0px; width: 1px; height: 1px; overflow-x: hidden; overflow-y: hidden;\"><span style=\"white-space: pre;\"> <\/span>&lt;script type=&#8221;text\/javascript&#8221;&gt;<\/div>\n<div id=\"_mcePaste\" style=\"position: absolute; left: -10000px; top: 0px; width: 1px; height: 1px; overflow-x: hidden; overflow-y: hidden;\"><span style=\"white-space: pre;\"> <\/span>function loadContent(id) {<\/div>\n<div id=\"_mcePaste\" style=\"position: absolute; left: -10000px; top: 0px; width: 1px; height: 1px; overflow-x: hidden; overflow-y: hidden;\"><span style=\"white-space: pre;\"> <\/span>$(&#8220;#copy_header&#8221;).load(&#8220;http:\/\/mydomain.com\/header.htm&#8221;);<\/div>\n<div id=\"_mcePaste\" style=\"position: absolute; left: -10000px; top: 0px; width: 1px; height: 1px; overflow-x: hidden; overflow-y: hidden;\"><span style=\"white-space: pre;\"> <\/span>$(&#8220;#copy_footer&#8221;).load(&#8220;http:\/\/mydomain.com\/footer.htm&#8221;);<\/div>\n<div id=\"_mcePaste\" style=\"position: absolute; left: -10000px; top: 0px; width: 1px; height: 1px; overflow-x: hidden; overflow-y: hidden;\"><span style=\"white-space: pre;\"> <\/span><\/div>\n<div id=\"_mcePaste\" style=\"position: absolute; left: -10000px; top: 0px; width: 1px; height: 1px; overflow-x: hidden; overflow-y: hidden;\"><span style=\"white-space: pre;\"> <\/span>}<\/div>\n<div id=\"_mcePaste\" style=\"position: absolute; left: -10000px; top: 0px; width: 1px; height: 1px; overflow-x: hidden; overflow-y: hidden;\"><span style=\"white-space: pre;\"> <\/span>&lt;\/script&gt;<\/div>\n<div id=\"_mcePaste\" style=\"position: absolute; left: -10000px; top: 0px; width: 1px; height: 1px; overflow-x: hidden; overflow-y: hidden;\">&lt;\/head&gt;<\/div>\n<div id=\"_mcePaste\" style=\"position: absolute; left: -10000px; top: 0px; width: 1px; height: 1px; overflow-x: hidden; overflow-y: hidden;\">&lt;body onLoad=&#8221;loadContent();&#8221;&gt;<\/div>\n<div id=\"_mcePaste\" style=\"position: absolute; left: -10000px; top: 0px; width: 1px; height: 1px; overflow-x: hidden; overflow-y: hidden;\"><span style=\"white-space: pre;\"> <\/span><\/div>\n<div id=\"_mcePaste\" style=\"position: absolute; left: -10000px; top: 0px; width: 1px; height: 1px; overflow-x: hidden; overflow-y: hidden;\"><span style=\"white-space: pre;\"> <\/span>&lt;div id=&#8221;copy_header&#8221; style=&#8221;width: 1000px; height: 150px;&#8221;&gt;<\/div>\n<div id=\"_mcePaste\" style=\"position: absolute; left: -10000px; top: 0px; width: 1px; height: 1px; overflow-x: hidden; overflow-y: hidden;\"><span style=\"white-space: pre;\"> <\/span>Header is loading..<\/div>\n<div id=\"_mcePaste\" style=\"position: absolute; left: -10000px; top: 0px; width: 1px; height: 1px; overflow-x: hidden; overflow-y: hidden;\"><span style=\"white-space: pre;\"> <\/span>&lt;\/div&gt;<\/div>\n<div id=\"_mcePaste\" style=\"position: absolute; left: -10000px; top: 0px; width: 1px; height: 1px; overflow-x: hidden; overflow-y: hidden;\"><span style=\"white-space: pre;\"> <\/span>Lorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsum has been the industry&#8217;s standard dummy text ever since the 1500s, when an unknown printer took a galley of type and scrambled it to make a type specimen book. It has survived not only five centuries, but also the leap into electronic typesetting, remaining essentially unchanged. It was popularised in the 1960s with the release of Letraset sheets containing Lorem Ipsum passages, and more recently with desktop publishing software like Aldus PageMaker including versions of Lorem Ipsum.<\/div>\n<div id=\"_mcePaste\" style=\"position: absolute; left: -10000px; top: 0px; width: 1px; height: 1px; overflow-x: hidden; overflow-y: hidden;\"><span style=\"white-space: pre;\"> <\/span>&lt;br \/&gt;<\/div>\n<div id=\"_mcePaste\" style=\"position: absolute; left: -10000px; top: 0px; width: 1px; height: 1px; overflow-x: hidden; overflow-y: hidden;\"><span style=\"white-space: pre;\"> <\/span>&lt;br \/&gt;<\/div>\n<div id=\"_mcePaste\" style=\"position: absolute; left: -10000px; top: 0px; width: 1px; height: 1px; overflow-x: hidden; overflow-y: hidden;\"><span style=\"white-space: pre;\"> <\/span>&lt;div id=&#8221;copy_footer&#8221; style=&#8221;width: 1000px; height: 30px;&#8221;&gt;<\/div>\n<div id=\"_mcePaste\" style=\"position: absolute; left: -10000px; top: 0px; width: 1px; height: 1px; overflow-x: hidden; overflow-y: hidden;\"><span style=\"white-space: pre;\"> <\/span>Footer is loading..<\/div>\n<div id=\"_mcePaste\" style=\"position: absolute; left: -10000px; top: 0px; width: 1px; height: 1px; overflow-x: hidden; overflow-y: hidden;\"><span style=\"white-space: pre;\"> <\/span>&lt;\/div&gt;<\/div>\n<div id=\"_mcePaste\" style=\"position: absolute; left: -10000px; top: 0px; width: 1px; height: 1px; overflow-x: hidden; overflow-y: hidden;\">&lt;\/body&gt;<\/div>\n<div id=\"_mcePaste\" style=\"position: absolute; left: -10000px; top: 0px; width: 1px; height: 1px; overflow-x: hidden; overflow-y: hidden;\">&lt;\/html&gt;<\/div>\n<address>html&gt;<\/address>\n<address>&lt;head&gt;<\/address>\n<address><span style=\"white-space: pre;\"> <\/span>&lt;title&gt;Header&amp;Footer import&lt;\/title&gt;<\/address>\n<address><span style=\"white-space: pre;\"> <\/span>&lt;script src=&#8221;jquery-latest.js&#8221; type=&#8221;text\/javascript&#8221;&gt;&lt;\/script&gt;<\/address>\n<address><span style=\"white-space: pre;\"> <\/span>&lt;script type=&#8221;text\/javascript&#8221;&gt;<\/address>\n<address><span style=\"white-space: pre;\"> <\/span>function loadContent(id) {<\/address>\n<address><span style=\"white-space: pre;\"> <\/span>$(&#8220;#copy_header&#8221;).load(&#8220;http:\/\/mydomain.com\/header.htm&#8221;);<\/address>\n<address><span style=\"white-space: pre;\"> <\/span>$(&#8220;#copy_footer&#8221;).load(&#8220;http:\/\/mydomain.com\/footer.htm&#8221;);<\/address>\n<address><span style=\"white-space: pre;\"> <\/span><\/address>\n<address><span style=\"white-space: pre;\"> <\/span>}<\/address>\n<address><span style=\"white-space: pre;\"> <\/span>&lt;\/script&gt;<\/address>\n<address>&lt;\/head&gt;<\/address>\n<address>&lt;body onLoad=&#8221;loadContent();&#8221;&gt;<\/address>\n<address><span style=\"white-space: pre;\"> <\/span><\/address>\n<address><span style=\"white-space: pre;\"> <\/span>&lt;div id=&#8221;copy_header&#8221; style=&#8221;width: 1000px; height: 150px;&#8221;&gt;<\/address>\n<address><span style=\"white-space: pre;\"> <\/span>Header is loading..<\/address>\n<address><span style=\"white-space: pre;\"> <\/span>&lt;\/div&gt;<\/address>\n<address><\/address>\n<address><span style=\"white-space: pre;\"> <\/span>Lorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsum has been the industry&#8217;s standard dummy text ever since the 1500s, when an unknown printer took a galley of type and scrambled it to make a type specimen book. It has survived not only five centuries, but also the leap into electronic typesetting, remaining essentially unchanged. It was popularised in the 1960s with the release of Letraset sheets containing Lorem Ipsum passages, and more recently with desktop publishing software like Aldus PageMaker including versions of Lorem Ipsum.<\/address>\n<address><span style=\"white-space: pre;\"> <\/span>&lt;br \/&gt;<\/address>\n<address><span style=\"white-space: pre;\"> <\/span>&lt;br \/&gt;<\/address>\n<address><\/address>\n<address><span style=\"white-space: pre;\"> <\/span>&lt;div id=&#8221;copy_footer&#8221; style=&#8221;width: 1000px; height: 30px;&#8221;&gt;<\/address>\n<address><span style=\"white-space: pre;\"> <\/span>Footer is loading..<\/address>\n<address><span style=\"white-space: pre;\"> <\/span>&lt;\/div&gt;<\/address>\n<address>&lt;\/body&gt;<\/address>\n<address>&lt;\/html&gt;<\/address>\n<\/address>\n<\/blockquote>\n","protected":false},"excerpt":{"rendered":"<p>When you want to insert a certain HTML code into one DIV you can use the following html code: html&gt; &lt;head&gt; &lt;title&gt;Header&amp;Footer import&lt;\/title&gt; &lt;script src=&#8221;jquery-latest.js&#8221; type=&#8221;text\/javascript&#8221;&gt;&lt;\/script&gt; &lt;script type=&#8221;text\/javascript&#8221;&gt; function loadContent(id) { $(&#8220;#copy_header&#8221;).load(&#8220;http:\/\/mydomain.com\/header.htm&#8221;); $(&#8220;#copy_footer&#8221;).load(&#8220;http:\/\/mydomain.com\/footer.htm&#8221;); } &lt;\/script&gt; &lt;\/head&gt; &lt;body onLoad=&#8221;loadContent();&#8221;&gt; &lt;div id=&#8221;copy_header&#8221; style=&#8221;width: 1000px; height: 150px;&#8221;&gt; Header is loading.. &lt;\/div&gt; Lorem Ipsum is simply dummy text of\u2026 <span class=\"read-more\"><a href=\"https:\/\/adriangrigoras.com\/blog\/insert-html-code-into-a-div-using-jquery\/\">Read More &raquo;<\/a><\/span><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[9,10],"tags":[],"class_list":["post-72","post","type-post","status-publish","format-standard","hentry","category-javascript","category-jquery"],"_links":{"self":[{"href":"https:\/\/adriangrigoras.com\/blog\/wp-json\/wp\/v2\/posts\/72","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/adriangrigoras.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/adriangrigoras.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/adriangrigoras.com\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/adriangrigoras.com\/blog\/wp-json\/wp\/v2\/comments?post=72"}],"version-history":[{"count":0,"href":"https:\/\/adriangrigoras.com\/blog\/wp-json\/wp\/v2\/posts\/72\/revisions"}],"wp:attachment":[{"href":"https:\/\/adriangrigoras.com\/blog\/wp-json\/wp\/v2\/media?parent=72"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/adriangrigoras.com\/blog\/wp-json\/wp\/v2\/categories?post=72"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/adriangrigoras.com\/blog\/wp-json\/wp\/v2\/tags?post=72"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}