<?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>JS &#8211; Sibeesh Passion</title>
	<atom:link href="https://sibeeshpassion.com/tag/js/feed/" rel="self" type="application/rss+xml" />
	<link>https://sibeeshpassion.com</link>
	<description>My passion towards life</description>
	<lastBuildDate>Fri, 17 Jul 2015 12:49:00 +0000</lastBuildDate>
	<language>en-US</language>
	<sy:updatePeriod>
	hourly	</sy:updatePeriod>
	<sy:updateFrequency>
	1	</sy:updateFrequency>
	<generator>https://wordpress.org/?v=6.9.4</generator>

<image>
	<url>/wp-content/uploads/2017/04/Sibeesh_Passion_Logo_Small.png</url>
	<title>JS &#8211; Sibeesh Passion</title>
	<link>https://sibeeshpassion.com</link>
	<width>32</width>
	<height>32</height>
</image> 
	<item>
		<title>Basic DOM Manipulation in JavaScript</title>
		<link>https://sibeeshpassion.com/basic-dom-manipulation-in-javascript/</link>
					<comments>https://sibeeshpassion.com/basic-dom-manipulation-in-javascript/#disqus_thread</comments>
		
		<dc:creator><![CDATA[SibeeshVenu]]></dc:creator>
		<pubDate>Thu, 29 Jan 2015 19:44:34 +0000</pubDate>
				<category><![CDATA[JavaScript]]></category>
		<category><![CDATA[Dom Manipulations]]></category>
		<category><![CDATA[Javascript]]></category>
		<category><![CDATA[JS]]></category>
		<guid isPermaLink="false">https://sibeeshpassion.com/?p=971</guid>

					<description><![CDATA[Introduction We are all familiar with JavaScript. This article is for those who have not touched JavaScript yet. Here I will tell you how to do simple DOM manipulations in JavaScript. Creation If you want to create a new element in the DOM, you can do as follows: [js] Var myDiv = document.createElement(‘div’); [/js] Addition If you want to add a new element to the existing element, you can do as follows. [js] document.body.appendChild(div); [/js] Here I am appending a div to the body. Style manipulation If you want to add some styles to an existing element, you can do [&#8230;]]]></description>
										<content:encoded><![CDATA[<p><strong>Introduction</strong></p>
<p>We are all familiar with JavaScript. This article is for those who have not touched JavaScript yet. Here I will tell you how to do simple DOM manipulations in JavaScript.</p>
<p><strong>Creation</strong></p>
<p>If you want to create a new element in the DOM, you can do as follows:<br />
[js]<br />
Var myDiv = document.createElement(‘div’);<br />
[/js]<br />
<strong>Addition</strong></p>
<p>If you want to add a new element to the existing element, you can do as follows.<br />
[js]<br />
document.body.appendChild(div);<br />
[/js]<br />
Here I am appending a div to the body.</p>
<p><strong>Style manipulation</strong></p>
<p>If you want to add some styles to an existing element, you can do as follows.</p>
<p><strong>Positioning</strong><br />
[js]<br />
div.style.right = ‘142px’;<br />
div.style.left = ’26px’;<br />
Modification<br />
[/js]<br />
<strong>Using classes:</strong> </p>
<p>If you want to assign a class name to an existing element, you can do as follows:<br />
[js]<br />
div.className = ‘myClassName’;<br />
[/js]<br />
<strong>Using ID:</strong><br />
[js]<br />
div.id = ‘myID’;<br />
[/js]<br />
<strong>Change the contents</strong></p>
<p><strong>using HTML:</strong><br />
[js]<br />
div.innerHTML = ‘&lt;div class=”myClassName”&gt;This is my HTML&lt;/div&gt;’;<br />
[/js]<br />
<strong>using text:</strong><br />
[js]<br />
div.textContent = ‘This is my text’;<br />
[/js]<br />
<strong>Removal</strong></p>
<p><strong>To remove an element from the DOM:</strong><br />
[js]<br />
div.parentNode.removeChild(div);<br />
[/js]<br />
Here we are removing a div from the parent node.</p>
<p><strong>Accessing</strong></p>
<p>We can access the elements in several ways. Let us see that now.</p>
<p><strong>ID</strong><br />
[js]<br />
document.getElementById(‘myID’);<br />
[/js]<br />
<strong>Tags</strong><br />
[js]<br />
document.getElementsByTagName(‘p’);<br />
[/js]<br />
<strong>Class</strong><br />
[js]<br />
document.getElementsByClassName(‘myClassName’);<br />
[/js]<br />
<strong>CSS selector</strong><br />
[js]<br />
document.querySelector(‘div #myID .myClassName’);<br />
[/js]<br />
That’s all for today. I hope someone finds this useful. Thanks for reading.</p>
<p>Kindest Regards,<br />
Sibeesh Venu</p>
]]></content:encoded>
					
					<wfw:commentRss>https://sibeeshpassion.com/basic-dom-manipulation-in-javascript/feed/</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
			</item>
	</channel>
</rss>
