<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	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/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>Open Source Web &#187; getlementbyid</title>
	<atom:link href="http://www.open-source-web.com/tag/getlementbyid/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.open-source-web.com</link>
	<description>Your open source for Development and Design</description>
	<lastBuildDate>Sun, 08 Jan 2012 10:21:46 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3.1</generator>
		<item>
		<title>Javascript get element by id</title>
		<link>http://www.open-source-web.com/javascript/javascript-get-element-by-id/</link>
		<comments>http://www.open-source-web.com/javascript/javascript-get-element-by-id/#comments</comments>
		<pubDate>Thu, 23 Apr 2009 21:36:16 +0000</pubDate>
		<dc:creator>Adi</dc:creator>
				<category><![CDATA[JavaScript]]></category>
		<category><![CDATA[dynamic]]></category>
		<category><![CDATA[getlementbyid]]></category>
		<category><![CDATA[style]]></category>

		<guid isPermaLink="false">http://www.open-source-web.com/?p=132</guid>
		<description><![CDATA[Javascript is probably the most awesome tool a web developer can use to make a website both functional and look nice. Javascript has also evolved over the years with the DOM it has become much easier to develop. One useful piece of code I always end up using when writing Javascript is getElementById, the way [...]]]></description>
			<content:encoded><![CDATA[<p>Javascript is probably the most awesome tool a web developer can use to make a website both functional and look nice. <strong>Javascript </strong>has also evolved over the years with the DOM it has become much easier to develop.</p>
<p>One useful piece of code I always end up using when writing Javascript is <strong>getElementById</strong>, the way Javascript evolved has given it much more compatibility with different browsers and in turn means you need less code to do more.</p>
<p><strong>getElementById</strong> allows you to modify any html element with a given ID. so for example if you have a &lt;div&gt; with the ID jstest it might look like this</p>
<p>&lt;div id=&#8221;jstest&#8221;&gt;howdy&lt;/div&gt;</p>
<p>Using <strong>document.getElementById(&#8216;jstest&#8217;)</strong> we can modify this element dynamically with javascript changing anything from its appearance or position with styling or use it within our javascript code.</p>
<p>using <strong>document.getElementById(&#8216;jstest&#8217;).innerHTML</strong> we could change or get the contents of the div.</p>
<p>Another pretty awesome use for the getElementById method would be to change the style of an element dynamically, maybe you want it to disappear when clicked or have a border when highlighted.</p>
<p>To change the background of an element we could use document.getelementById(&#8216;jstest&#8217;).style.background-color = &#8216;#dedede&#8217;  this will work with any styling you could apply to an element.</p>
<p>If you are like 90% of the old school web developers I know you probably don&#8217;t like using javascript but the modern DOM it is couldn&#8217;t be easier.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.open-source-web.com/javascript/javascript-get-element-by-id/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>

