<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
		>
<channel>
	<title>Comments on: How to dynamically add content to a div and store the content to a cookie via JavaScript</title>
	<atom:link href="http://www.randomsnippets.com/2008/04/14/how-to-dynamically-add-content-to-a-div-via-javascript/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.randomsnippets.com/2008/04/14/how-to-dynamically-add-content-to-a-div-via-javascript/</link>
	<description>Random Snippets of Code and Ideas for any Web Developer</description>
	<lastBuildDate>Sat, 17 Jul 2010 11:08:13 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=abc</generator>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
		<item>
		<title>By: Donald</title>
		<link>http://www.randomsnippets.com/2008/04/14/how-to-dynamically-add-content-to-a-div-via-javascript/comment-page-1/#comment-11688</link>
		<dc:creator>Donald</dc:creator>
		<pubDate>Tue, 23 Feb 2010 15:32:10 +0000</pubDate>
		<guid isPermaLink="false">http://www.randomsnippets.com/?p=14#comment-11688</guid>
		<description>Did anyone ever find out how to use the cookie to retrieve the users last hidden/shown divs ?

I&#039;ve seen tutorials for names etc, but nothing yet on how to keep toggled settings.

I&#039;m looking for toggle2 settings to be kept.

Thanks for any pointers!</description>
		<content:encoded><![CDATA[<p>Did anyone ever find out how to use the cookie to retrieve the users last hidden/shown divs ?</p>
<p>I&#8217;ve seen tutorials for names etc, but nothing yet on how to keep toggled settings.</p>
<p>I&#8217;m looking for toggle2 settings to be kept.</p>
<p>Thanks for any pointers!</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: [MW2CC] Admin</title>
		<link>http://www.randomsnippets.com/2008/04/14/how-to-dynamically-add-content-to-a-div-via-javascript/comment-page-1/#comment-9631</link>
		<dc:creator>[MW2CC] Admin</dc:creator>
		<pubDate>Wed, 23 Dec 2009 07:58:23 +0000</pubDate>
		<guid isPermaLink="false">http://www.randomsnippets.com/?p=14#comment-9631</guid>
		<description>Fantastic guide!</description>
		<content:encoded><![CDATA[<p>Fantastic guide!</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Tom Arnfeld</title>
		<link>http://www.randomsnippets.com/2008/04/14/how-to-dynamically-add-content-to-a-div-via-javascript/comment-page-1/#comment-1681</link>
		<dc:creator>Tom Arnfeld</dc:creator>
		<pubDate>Mon, 16 Mar 2009 19:32:57 +0000</pubDate>
		<guid isPermaLink="false">http://www.randomsnippets.com/?p=14#comment-1681</guid>
		<description>Hey,
Is there a way to save the contents of a  (all of the  inside) with cookies and then when the page loads, open the cookie and display the saved data as the &#039;s inside the  tag?

Also, the user updates the cookie with a link?

Please help.. i would greatly appreciate it :)</description>
		<content:encoded><![CDATA[<p>Hey,<br />
Is there a way to save the contents of a  (all of the  inside) with cookies and then when the page loads, open the cookie and display the saved data as the &#8217;s inside the  tag?</p>
<p>Also, the user updates the cookie with a link?</p>
<p>Please help.. i would greatly appreciate it :)</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Bryan Fox</title>
		<link>http://www.randomsnippets.com/2008/04/14/how-to-dynamically-add-content-to-a-div-via-javascript/comment-page-1/#comment-930</link>
		<dc:creator>Bryan Fox</dc:creator>
		<pubDate>Thu, 11 Dec 2008 20:32:07 +0000</pubDate>
		<guid isPermaLink="false">http://www.randomsnippets.com/?p=14#comment-930</guid>
		<description>Nifty!   Worked the first time!

QUESTION, though.


While making specific use of it I stumbled into a problem that I hope someone can help on.  This may not be the best/only way to skin this cat, but we have a PHP/MySQL page that has to  be modified to ADD rows for data entry when needed.  I have abandoned the traditional DOM object methods of adding a single row, since in this case the addition would be a whole block of rows.  I don&#039;t think I&#039;m smart enough to do that...  

Anyway, an idea hit me to make use of our MySQL dB and store the rows in there, and retrieve them using your method.  




function addContent(divName, content) {
     document.getElementById(divName).innerHTML = content;
}





Content to be added:







Your content will be added dynamically below:


Skipping an ultimate requirement that the content of the addition needs to be invisible and inaccessible, I tried the above out.  It works, but the variable ($_value) has form elements in it, including .   The close of the tag, interrupts the value and throws the remaining code to the page, not awaiting insertion by the Submit Button.

Example:  http://www.facey.com/insert_content1.php


The Submit button successfully produces the part that stayed inside, but you see my problem.

IS THERE A WAY to use this javascript addContent function, incorporate the utility of an ADD button, and avoid using the packaging of FORMS? 



Thanks for any help!



p.s.  The PHP component is transparent.  Direct inclusion of the HTML contained in the variable as the value of TEXTAREA produces the same result.</description>
		<content:encoded><![CDATA[<p>Nifty!   Worked the first time!</p>
<p>QUESTION, though.</p>
<p>While making specific use of it I stumbled into a problem that I hope someone can help on.  This may not be the best/only way to skin this cat, but we have a PHP/MySQL page that has to  be modified to ADD rows for data entry when needed.  I have abandoned the traditional DOM object methods of adding a single row, since in this case the addition would be a whole block of rows.  I don&#8217;t think I&#8217;m smart enough to do that&#8230;  </p>
<p>Anyway, an idea hit me to make use of our MySQL dB and store the rows in there, and retrieve them using your method.  </p>
<p>function addContent(divName, content) {<br />
     document.getElementById(divName).innerHTML = content;<br />
}</p>
<p>Content to be added:</p>
<p>Your content will be added dynamically below:</p>
<p>Skipping an ultimate requirement that the content of the addition needs to be invisible and inaccessible, I tried the above out.  It works, but the variable ($_value) has form elements in it, including .   The close of the tag, interrupts the value and throws the remaining code to the page, not awaiting insertion by the Submit Button.</p>
<p>Example:  <a href="http://www.facey.com/insert_content1.php" rel="nofollow">http://www.facey.com/insert_content1.php</a></p>
<p>The Submit button successfully produces the part that stayed inside, but you see my problem.</p>
<p>IS THERE A WAY to use this javascript addContent function, incorporate the utility of an ADD button, and avoid using the packaging of FORMS? </p>
<p>Thanks for any help!</p>
<p>p.s.  The PHP component is transparent.  Direct inclusion of the HTML contained in the variable as the value of TEXTAREA produces the same result.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Suresh Babu</title>
		<link>http://www.randomsnippets.com/2008/04/14/how-to-dynamically-add-content-to-a-div-via-javascript/comment-page-1/#comment-179</link>
		<dc:creator>Suresh Babu</dc:creator>
		<pubDate>Sun, 03 Aug 2008 02:03:06 +0000</pubDate>
		<guid isPermaLink="false">http://www.randomsnippets.com/?p=14#comment-179</guid>
		<description>Thank you Knix. This is what I was looking for.</description>
		<content:encoded><![CDATA[<p>Thank you Knix. This is what I was looking for.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Knix</title>
		<link>http://www.randomsnippets.com/2008/04/14/how-to-dynamically-add-content-to-a-div-via-javascript/comment-page-1/#comment-178</link>
		<dc:creator>Knix</dc:creator>
		<pubDate>Sat, 02 Aug 2008 17:08:37 +0000</pubDate>
		<guid isPermaLink="false">http://www.randomsnippets.com/?p=14#comment-178</guid>
		<description>Hi suresh babu, 

I finally got around to doing this demo.  I hope this information helps.</description>
		<content:encoded><![CDATA[<p>Hi suresh babu, </p>
<p>I finally got around to doing this demo.  I hope this information helps.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Knix</title>
		<link>http://www.randomsnippets.com/2008/04/14/how-to-dynamically-add-content-to-a-div-via-javascript/comment-page-1/#comment-153</link>
		<dc:creator>Knix</dc:creator>
		<pubDate>Mon, 14 Jul 2008 14:35:40 +0000</pubDate>
		<guid isPermaLink="false">http://www.randomsnippets.com/?p=14#comment-153</guid>
		<description>Hi suresh babu,

You sure can save the content.  There are several ways to do this and I will try to think of the simplest way and post an answer by this evening.</description>
		<content:encoded><![CDATA[<p>Hi suresh babu,</p>
<p>You sure can save the content.  There are several ways to do this and I will try to think of the simplest way and post an answer by this evening.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: suresh babu</title>
		<link>http://www.randomsnippets.com/2008/04/14/how-to-dynamically-add-content-to-a-div-via-javascript/comment-page-1/#comment-152</link>
		<dc:creator>suresh babu</dc:creator>
		<pubDate>Mon, 14 Jul 2008 08:08:19 +0000</pubDate>
		<guid isPermaLink="false">http://www.randomsnippets.com/?p=14#comment-152</guid>
		<description>Is there a way to save this content so that next time when a user opens the page, it should be the new content.</description>
		<content:encoded><![CDATA[<p>Is there a way to save this content so that next time when a user opens the page, it should be the new content.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: suresh babu</title>
		<link>http://www.randomsnippets.com/2008/04/14/how-to-dynamically-add-content-to-a-div-via-javascript/comment-page-1/#comment-151</link>
		<dc:creator>suresh babu</dc:creator>
		<pubDate>Mon, 14 Jul 2008 07:54:31 +0000</pubDate>
		<guid isPermaLink="false">http://www.randomsnippets.com/?p=14#comment-151</guid>
		<description>Great Work. I was trying our such a script. Thanks</description>
		<content:encoded><![CDATA[<p>Great Work. I was trying our such a script. Thanks</p>
]]></content:encoded>
	</item>
</channel>
</rss>
