<?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>HTML5 &#8211; Sibeesh Passion</title>
	<atom:link href="https://sibeeshpassion.com/category/html5/feed/" rel="self" type="application/rss+xml" />
	<link>https://sibeeshpassion.com</link>
	<description>My passion towards life</description>
	<lastBuildDate>Wed, 11 Jul 2018 16:28:31 +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>HTML5 &#8211; Sibeesh Passion</title>
	<link>https://sibeeshpassion.com</link>
	<width>32</width>
	<height>32</height>
</image> 
	<item>
		<title>Introduction to IndexedDB</title>
		<link>https://sibeeshpassion.com/introduction-to-indexeddb/</link>
					<comments>https://sibeeshpassion.com/introduction-to-indexeddb/#disqus_thread</comments>
		
		<dc:creator><![CDATA[SibeeshVenu]]></dc:creator>
		<pubDate>Wed, 10 Feb 2016 00:00:39 +0000</pubDate>
				<category><![CDATA[HTML5]]></category>
		<category><![CDATA[Storage In HTML5]]></category>
		<category><![CDATA[IndexedDB]]></category>
		<category><![CDATA[IndexedDB And Web SQL]]></category>
		<category><![CDATA[openCursor()]]></category>
		<category><![CDATA[Storage in HTML5]]></category>
		<guid isPermaLink="false">http://sibeecst_passion.com/?p=11167</guid>

					<description><![CDATA[[toc] Introduction In this post, we will see some information about IndexedDB. As the name implies, IndexedDB is a database in which we can do all kind of operations we do in a normal database. This IndexedDB has been introduced with the HTML5 . This allows a user to store a large amount of data in user&#8217;s browser. It has been proved that IndexedDB is more powerful and efficient than other storage mechanisms like local storage and session storage. Basically, IndexedDB is an API which helps the developers to do some database operations in client side, like creating a database, [&#8230;]]]></description>
										<content:encoded><![CDATA[<p>[toc]</p>
<h3>Introduction</h3>
<p>
In this post, we will see some information about IndexedDB. As the name implies, IndexedDB is a <a href="http://sibeeshpassion.com/category/database/" target="_blank">database </a>in which we can do all kind of operations we do in a normal database. This IndexedDB has been introduced with the <a href="http://sibeeshpassion.com/category/html5/" target="_blank">HTML5 </a>. This allows a user to store a large amount of data in user&#8217;s browser. It has been proved that IndexedDB is more powerful and efficient than other storage mechanisms like local storage and session storage. Basically, IndexedDB is an API which helps the developers to do some database operations in client side, like creating a database, open the transaction, creating tables, inserting values to tables, deleting values, reading the data. If you need any other way to save some data in client side, you can use <a href="http://sibeeshpassion.com/tag/storage-in-html5/" target="_blank">storage mechanisms </a> introduced in HTML5. Now we will look some of the operations a developer can do with IndexedDB. I hope you will like this.
</p>
<h3>Background</h3>
<p>
Before introducing IndexedDB, developers were familiar with Web SQL. If you need to know more about Web SQL you can see here: <a href="http://sibeeshpassion.com/introduction-to-web-sql/" target="_blank">Web SQL Introduction</a>.
</p>
<h3>Why to use IndexedDB instead Web SQL?</h3>
<p>
W3C has been announced that use of Web SQL is obsolete and deprecated, hence it is not recommended using Web SQL in your applications. Most of the modern web browsers like Mozilla does not support the use of Web SQL, this is also a great limitation of Web SQL. </p>
<p>Now we have an alternative to Web SQL, IndexedDB which more efficient and faster than Web SQL. Below are some of the main advantages of IndexedDB.</p>
<li>It stores the data as Key-Pair values</li>
<li>It is Asynchronous</li>
<li>It is non relational</li>
<li>Can access the data from the same domain</li>
<p><h3>Using the code</h3>
<p>
As you all know, the first step to work with a database is just creating it. </p>
<h4>Create/Open IndexedDB Database</h4>
<p>It is always better to check whether your browser is supporting IndexedDB or not. To check that you can use the following syntax. </p>
<p>[js]<br />
&lt;script type=&quot;text/javascript&quot;&gt;<br />
        window.indexedDB = window.indexedDB || window.mozIndexedDB || window.webkitIndexedDB || window.msIndexedDB;<br />
        //check whether the database is created or not.<br />
        if (!window.indexedDB) {<br />
            alert(&quot;Oops, Does not support IndexedDB&quot;);<br />
        }<br />
    &lt;/script&gt;<br />
[/js]</p>
<p>So if your browser is supporting IndexedDB, you are ready to go!. Cool!. Now we can create a database.  </p>
<p>[js]<br />
//check whether the database is created or not.<br />
        if (!window.indexedDB) {<br />
            alert(&quot;Oops, Does not support IndexedDB&quot;);<br />
        } else {<br />
            //Create database<br />
            var dbName = &#8216;myDB&#8217;;// Database name<br />
            var dbVersion = 2;// Database version<br />
            var crDB = window.indexedDB.open(dbName, dbVersion);<br />
        }<br />
[/js]</p>
<p>Here the first parameter is the database name and the second one is the version of your database. A version represents your database&#8217;s current schema. If everything goes well, you can see your database in your browser&#8217;s resources as follows.</p>
<div id="attachment_11168" style="width: 614px" class="wp-caption alignnone"><a href="http://sibeeshpassion.com/wp-content/uploads/2016/02/IndexedDB-Creation.png"><img fetchpriority="high" decoding="async" aria-describedby="caption-attachment-11168" src="http://sibeeshpassion.com/wp-content/uploads/2016/02/IndexedDB-Creation.png" alt="IndexedDB Creation" width="604" height="255" class="size-full wp-image-11168" srcset="/wp-content/uploads/2016/02/IndexedDB-Creation.png 604w, /wp-content/uploads/2016/02/IndexedDB-Creation-300x127.png 300w, /wp-content/uploads/2016/02/IndexedDB-Creation-400x169.png 400w" sizes="(max-width: 604px) 100vw, 604px" /></a><p id="caption-attachment-11168" class="wp-caption-text">IndexedDB Creation</p></div>
<p>When you create a database there some certain events are getting fired, they are</p>
<h5>onupgradeneeded</h5>
<p>[js]<br />
crDB.onupgradeneeded = function (event) {<br />
                alert(&quot;That&#8217;s cool, we are upgrading&quot;);<br />
                db = event.target.result;<br />
                var objectStore = db.createObjectStore(&quot;UserName&quot;, { keyPath: &quot;UserID&quot; });<br />
            };<br />
[/js]</p>
<p>This event gets fired when you try upgrading your database. Here we are creating an object store with name &#8216;UserName&#8217; and index key &#8216;UserID&#8217;. Below is the output you get when the onupgradeneeded is fired. </p>
<div id="attachment_11171" style="width: 455px" class="wp-caption alignnone"><a href="http://sibeeshpassion.com/wp-content/uploads/2016/02/IndexedDB-onupgradeneeded-Alert.png"><img decoding="async" aria-describedby="caption-attachment-11171" src="http://sibeeshpassion.com/wp-content/uploads/2016/02/IndexedDB-onupgradeneeded-Alert.png" alt="IndexedDB onupgradeneeded Alert" width="445" height="179" class="size-full wp-image-11171" srcset="/wp-content/uploads/2016/02/IndexedDB-onupgradeneeded-Alert.png 445w, /wp-content/uploads/2016/02/IndexedDB-onupgradeneeded-Alert-300x121.png 300w, /wp-content/uploads/2016/02/IndexedDB-onupgradeneeded-Alert-400x161.png 400w" sizes="(max-width: 445px) 100vw, 445px" /></a><p id="caption-attachment-11171" class="wp-caption-text">IndexedDB onupgradeneeded Alert</p></div>
<div id="attachment_11172" style="width: 660px" class="wp-caption alignnone"><a href="http://sibeeshpassion.com/wp-content/uploads/2016/02/IndexedDB-onupgradeneeded-Output-e1454589883218.png"><img decoding="async" aria-describedby="caption-attachment-11172" src="http://sibeeshpassion.com/wp-content/uploads/2016/02/IndexedDB-onupgradeneeded-Output-e1454589883218.png" alt="IndexedDB onupgradeneeded Output" width="650" height="202" class="size-full wp-image-11172" srcset="/wp-content/uploads/2016/02/IndexedDB-onupgradeneeded-Output-e1454589883218.png 650w, /wp-content/uploads/2016/02/IndexedDB-onupgradeneeded-Output-e1454589883218-300x93.png 300w, /wp-content/uploads/2016/02/IndexedDB-onupgradeneeded-Output-e1454589883218-400x124.png 400w" sizes="(max-width: 650px) 100vw, 650px" /></a><p id="caption-attachment-11172" class="wp-caption-text">IndexedDB onupgradeneeded Output</p></div>
<h5>onsuccess</h5>
<p>[js]<br />
crDB.onsuccess = function (event) {<br />
                alert(&quot;Awesome, You have successfully Opened a Databse!&quot;);<br />
                db = event.target.result;<br />
            }<br />
[/js]</p>
<p>If there are no errors, you will get an alert as follows.</p>
<div id="attachment_11170" style="width: 458px" class="wp-caption alignnone"><a href="http://sibeeshpassion.com/wp-content/uploads/2016/02/IndexedDB-OnSuccess-Alert.png"><img decoding="async" aria-describedby="caption-attachment-11170" src="http://sibeeshpassion.com/wp-content/uploads/2016/02/IndexedDB-OnSuccess-Alert.png" alt="IndexedDB OnSuccess Alert" width="448" height="181" class="size-full wp-image-11170" srcset="/wp-content/uploads/2016/02/IndexedDB-OnSuccess-Alert.png 448w, /wp-content/uploads/2016/02/IndexedDB-OnSuccess-Alert-300x121.png 300w, /wp-content/uploads/2016/02/IndexedDB-OnSuccess-Alert-400x162.png 400w" sizes="(max-width: 448px) 100vw, 448px" /></a><p id="caption-attachment-11170" class="wp-caption-text">IndexedDB OnSuccess Alert</p></div>
<h5>onerror</h5>
<p>[js]<br />
 crDB.onerror = function (event) {<br />
                alert(&quot;Oops, There is error!&quot;, event);<br />
            }<br />
[/js]</p>
<p>Here crDB is our database instance. Once this is done, we can start using the transaction as we use in SQL. </p>
<h4>Creating transaction</h4>
<p>To create a transaction we can use the following syntax. We can use <em>transaction</em> method from our database instance.</p>
<p>[js]<br />
//Creating transaction<br />
            var myTran = db.transaction([&quot;UserName&quot;], &quot;readwrite&quot;);</p>
<p>            myTran.oncomplete = function (e) {<br />
                alert(&quot;Awesome, Transaction is successfully created!&quot;);<br />
            };</p>
<p>            myTran.onerror = function (e) {<br />
                alert(&quot;Oops, There is error!&quot;, e.message);<br />
            };<br />
[/js]</p>
<p>Here db is our database instance. And myTran is our transaction object which we are going to use for our upcoming operations. We are creating a transaction with read-write permission, that is why we have given a property as &#8216;readwrite&#8217; while creating a transaction. Why we use transaction is, as you all know transaction can be rollbacked. For example, if any of the operation throws an error, the transaction will be rollbacked so there won&#8217;t be any kind of mismatching data happening. And of course, we can easily manage error logs with the help of transaction. Shall we write queries needed for our operations?</p>
<h4>Adding the data</h4>
<p>Once our transaction is ready we can insert some data into our object in the transaction on success event, which we have called inside of database onsuccess event. Please check the below code.</p>
<p>[js]<br />
crDB.onsuccess = function (event) {<br />
                alert(&quot;Awesome, You have successfully Opened a Databse!&quot;);<br />
                db = event.target.result;</p>
<p>                //Creating transaction<br />
                var myTran = db.transaction([&quot;UserName&quot;], &quot;readwrite&quot;);</p>
<p>                myTran.oncomplete = function (e) {<br />
                    alert(&quot;Awesome, Transaction is successfully created!&quot;);<br />
                };</p>
<p>                myTran.onsuccess = function (e) {<br />
                    alert(&quot;Awesome, Transaction is successfully created!&quot;);<br />
                    //Adding the data<br />
                    var myObj = myTran.objectStore(&quot;UserName&quot;);</p>
<p>                    var myNames = [&quot;Sibi&quot;, &quot;Aji&quot;, &quot;Ansu&quot;, &quot;Shantu&quot;, &quot;Aghil&quot;];//Array with names</p>
<p>                    for (var i = 0; i &lt; 5; i++) {//Adding 5 objects<br />
                        myObj.add({ UserID: &#8216;SBKL0&#8217; + i, Name: myNames[i] });<br />
                    }<br />
                };</p>
<p>                myTran.onerror = function (e) {<br />
                    alert(&quot;Oops, There is error!&quot;, e.message);<br />
                };</p>
<p>            }<br />
[/js]</p>
<p>Here myNames is the array in which we have few names and we are using a loop to insert few data to the object. Now you can see that your data have been added to the object in your browser&#8217;s resources. </p>
<div id="attachment_11176" style="width: 660px" class="wp-caption alignnone"><a href="http://sibeeshpassion.com/wp-content/uploads/2016/02/IndexedDB-Adding-Data-To-Objects-e1454657780204.png"><img decoding="async" aria-describedby="caption-attachment-11176" src="http://sibeeshpassion.com/wp-content/uploads/2016/02/IndexedDB-Adding-Data-To-Objects-e1454657780204.png" alt="IndexedDB Adding Data To Objects" width="650" height="159" class="size-full wp-image-11176" srcset="/wp-content/uploads/2016/02/IndexedDB-Adding-Data-To-Objects-e1454657780204.png 650w, /wp-content/uploads/2016/02/IndexedDB-Adding-Data-To-Objects-e1454657780204-300x73.png 300w, /wp-content/uploads/2016/02/IndexedDB-Adding-Data-To-Objects-e1454657780204-400x98.png 400w" sizes="(max-width: 650px) 100vw, 650px" /></a><p id="caption-attachment-11176" class="wp-caption-text">IndexedDB Adding Data To Objects</p></div>
<p>We have successfully added data. Right? Now we will see how we can remove the data we just added 🙂</p>
<h4>Removing the data</h4>
<p>If there is adding, there should be deleting :). You can delete an object from object store as follows.</p>
<p>[js]<br />
setTimeout(function () {<br />
                        db.transaction([&quot;UserName&quot;], &quot;readwrite&quot;).objectStore(&quot;UserName&quot;).delete(&#8216;SBKL00&#8217;);<br />
                    }, 10000);<br />
[/js]</p>
<p>So you can rewrite the on success event of transaction s follows. </p>
<p>[js]<br />
myTran.onsuccess = function (e) {<br />
                    alert(&quot;Awesome, Transaction is successfully created!&quot;);<br />
                    //Adding the data<br />
                    var myObj = myTran.objectStore(&quot;UserName&quot;);</p>
<p>                    var myNames = [&quot;Sibi&quot;, &quot;Aji&quot;, &quot;Ansu&quot;, &quot;Shantu&quot;, &quot;Aghil&quot;];//Array with names</p>
<p>                    for (var i = 0; i &lt; 5; i++) {//Adding 5 objects<br />
                        myObj.add({ UserID: &#8216;SBKL0&#8217; + i, Name: myNames[i] });<br />
                    }</p>
<p>                    setTimeout(function () {<br />
                        db.transaction([&quot;UserName&quot;], &quot;readwrite&quot;).objectStore(&quot;UserName&quot;).delete(&#8216;SBKL00&#8217;);<br />
                    }, 10000);<br />
                };<br />
[/js]</p>
<p>It can give you an output as follows.</p>
<div id="attachment_11177" style="width: 644px" class="wp-caption alignnone"><a href="http://sibeeshpassion.com/wp-content/uploads/2016/02/IndexedDB-Deleting-Data-From-Objects.png"><img decoding="async" aria-describedby="caption-attachment-11177" src="http://sibeeshpassion.com/wp-content/uploads/2016/02/IndexedDB-Deleting-Data-From-Objects-1024x242.png" alt="IndexedDB Deleting Data From Objects" width="634" height="150" class="size-large wp-image-11177" srcset="/wp-content/uploads/2016/02/IndexedDB-Deleting-Data-From-Objects-1024x242.png 1024w, /wp-content/uploads/2016/02/IndexedDB-Deleting-Data-From-Objects-300x71.png 300w, /wp-content/uploads/2016/02/IndexedDB-Deleting-Data-From-Objects-768x182.png 768w, /wp-content/uploads/2016/02/IndexedDB-Deleting-Data-From-Objects-400x95.png 400w, /wp-content/uploads/2016/02/IndexedDB-Deleting-Data-From-Objects.png 1036w" sizes="(max-width: 634px) 100vw, 634px" /></a><p id="caption-attachment-11177" class="wp-caption-text">IndexedDB Deleting Data From Objects</p></div>
<p>Now we will see how we can access a particular data from the object store. </p>
<h4>Access the data with key</h4>
<p>To access a particular data, we will add a button and in the button click event, we will fetch the details needed as a request. </p>
<p>[html]<br />
 &lt;input id=&quot;btnGet&quot; type=&quot;button&quot; value=&quot;Get Name&quot; /&gt;<br />
[/html]</p>
<p>Click event is as follows.</p>
<p>[js]<br />
$(function () {<br />
            $(&#8216;#btnGet&#8217;).click(function () {<br />
                var get = db.transaction([&quot;UserName&quot;], &quot;readwrite&quot;).objectStore(&quot;UserName&quot;).get(&#8216;SBKL01&#8217;);<br />
                get.onsuccess = function (event) {<br />
                    alert(&quot;The name you have requested is : &quot; + get.result.Name);<br />
                };</p>
<p>            });<br />
        });<br />
[/js]</p>
<p>You can get the alert as follows, if your run your code. </p>
<div id="attachment_11179" style="width: 528px" class="wp-caption alignnone"><a href="http://sibeeshpassion.com/wp-content/uploads/2016/02/IndexedDB-Get-The-Data-With-Key.png"><img decoding="async" aria-describedby="caption-attachment-11179" src="http://sibeeshpassion.com/wp-content/uploads/2016/02/IndexedDB-Get-The-Data-With-Key.png" alt="IndexedDB Get The Data With Key" width="518" height="340" class="size-full wp-image-11179" srcset="/wp-content/uploads/2016/02/IndexedDB-Get-The-Data-With-Key.png 518w, /wp-content/uploads/2016/02/IndexedDB-Get-The-Data-With-Key-300x197.png 300w, /wp-content/uploads/2016/02/IndexedDB-Get-The-Data-With-Key-400x263.png 400w" sizes="(max-width: 518px) 100vw, 518px" /></a><p id="caption-attachment-11179" class="wp-caption-text">IndexedDB Get The Data With Key</p></div>
<p>Now we will see how we can update data with the Get method. </p>
<h4>Updating the data</h4>
<p>To update the data we will have a button and in the button click we will fire the needed code. </p>
<p>[html]<br />
 &lt;input id=&quot;btnUpdate&quot; type=&quot;button&quot; value=&quot;Update Name&quot; /&gt;<br />
[/html]</p>
<p>And click event is as follows.</p>
<p>[js]<br />
$(&#8216;#btnUpdate&#8217;).click(function () {<br />
                var updObject = db.transaction([&quot;UserName&quot;], &quot;readwrite&quot;).objectStore(&quot;UserName&quot;);<br />
                var upd=updObject.get(&#8216;SBKL03&#8217;);<br />
                upd.onsuccess = function (event) {<br />
                    upd.result.Name = &#8216;New Name&#8217;;<br />
                    updObject.put(upd.result);<br />
                };</p>
<p>            });<br />
[/js]</p>
<p>Here we are getting an element using the get method, and we are updating the value in the result, once it is done, we will assign that new result to the object store using put method.</p>
<p>It will give you an output as follows.</p>
<div id="attachment_11180" style="width: 644px" class="wp-caption alignnone"><a href="http://sibeeshpassion.com/wp-content/uploads/2016/02/IndexedDB-Update-The-Data-With-Key.png"><img decoding="async" aria-describedby="caption-attachment-11180" src="http://sibeeshpassion.com/wp-content/uploads/2016/02/IndexedDB-Update-The-Data-With-Key-1024x247.png" alt="IndexedDB Update The Data With Key" width="634" height="153" class="size-large wp-image-11180" srcset="/wp-content/uploads/2016/02/IndexedDB-Update-The-Data-With-Key-1024x247.png 1024w, /wp-content/uploads/2016/02/IndexedDB-Update-The-Data-With-Key-300x72.png 300w, /wp-content/uploads/2016/02/IndexedDB-Update-The-Data-With-Key-768x185.png 768w, /wp-content/uploads/2016/02/IndexedDB-Update-The-Data-With-Key-400x96.png 400w, /wp-content/uploads/2016/02/IndexedDB-Update-The-Data-With-Key.png 1057w" sizes="(max-width: 634px) 100vw, 634px" /></a><p id="caption-attachment-11180" class="wp-caption-text">IndexedDB Update The Data With Key</p></div>
<p>Another interesting thing is, we can use cursors also as we use in SQL if we need to loop through some data. Here I will show you how we can do that. </p>
<h4>Using Cursor</h4>
<p>Create a button and write few code as  follows.</p>
<p>[html]<br />
&lt;input id=&quot;btnShow&quot; type=&quot;button&quot; value=&quot;Show the data&quot; /&gt;<br />
[/html]</p>
<p>Then we will create an HTML table.</p>
<p>[html]<br />
&lt;div id=&quot;myTab&quot;&gt;<br />
        &lt;table id=&quot;show&quot;&gt;<br />
            &lt;thead&gt;<br />
                &lt;th&gt;User ID &lt;/th&gt;<br />
                &lt;th&gt;Name&lt;/th&gt;<br />
            &lt;/thead&gt;<br />
            &lt;tbody&gt;&lt;/tbody&gt;<br />
        &lt;/table&gt;<br />
    &lt;/div&gt;<br />
[/html]</p>
<p>Now we can write the cursor as follows. </p>
<p>[js]<br />
$(&#8216;#btnShow&#8217;).click(function () {<br />
                var curObject = db.transaction([&quot;UserName&quot;], &quot;readwrite&quot;).objectStore(&quot;UserName&quot;);<br />
                curObject.openCursor().onsuccess = function (event) { //Opening the cursor<br />
                    var cur = event.target.result;<br />
                    if (cur) {// Checks for the cursor<br />
                        $(&#8216;#show&#8217;).append(&#8216;&lt;tr&gt;&lt;td&gt;&#8217; + cur.key + &#8216;&lt;/td&gt;&lt;td&gt;&#8217; + cur.value.Name + &#8216;&lt;/td&gt;&lt;/tr&gt;&#8217;);<br />
                        cur.continue();<br />
                    }<br />
                };<br />
                $(&#8216;#myTab&#8217;).show();<br />
            });<br />
[/js]</p>
<p>Here we are creating a cursor using the function <em>openCursor()</em> and in the onsuccess event we are looping through the cursor. You can always give some styles to your table.</p>
<p>[css]<br />
&lt;style&gt;<br />
        table, tr, td, th {<br />
            border: 1px solid #ccc;<br />
            border-radius: 5px;<br />
            padding: 10px;<br />
            margin: 10px;<br />
        }<br />
    &lt;/style&gt;<br />
[/css]</p>
<p>That is all 🙂 Now when you click the show button, you can see the data in a table format as follows. </p>
<div id="attachment_11183" style="width: 311px" class="wp-caption alignnone"><a href="http://sibeeshpassion.com/wp-content/uploads/2016/02/IndexedDB-Using-Cursor.png"><img decoding="async" aria-describedby="caption-attachment-11183" src="http://sibeeshpassion.com/wp-content/uploads/2016/02/IndexedDB-Using-Cursor.png" alt="IndexedDB Using Cursor" width="301" height="296" class="size-full wp-image-11183" srcset="/wp-content/uploads/2016/02/IndexedDB-Using-Cursor.png 301w, /wp-content/uploads/2016/02/IndexedDB-Using-Cursor-300x295.png 300w" sizes="(max-width: 301px) 100vw, 301px" /></a><p id="caption-attachment-11183" class="wp-caption-text">IndexedDB Using Cursor</p></div>
<h3>Complete code</h3>
<p>
[html]<br />
&lt;!DOCTYPE html&gt;<br />
&lt;html&gt;<br />
&lt;head&gt;<br />
    &lt;title&gt;Introduction to IndexedDB&lt;/title&gt;<br />
    &lt;script src=&quot;Scripts/jquery-1.11.1.min.js&quot;&gt;&lt;/script&gt;<br />
    &lt;script type=&quot;text/javascript&quot;&gt;<br />
        var dbName = &#8216;myDB&#8217;;// Database name<br />
        var dbVersion = 2;// Database version<br />
        var crDB;<br />
        var db;<br />
        window.indexedDB = window.indexedDB || window.mozIndexedDB || window.webkitIndexedDB || window.msIndexedDB;<br />
        //check whether the database is created or not.<br />
        if (!window.indexedDB) {<br />
            alert(&quot;Oops, Does not support IndexedDB&quot;);<br />
        } else {<br />
            //Create database<br />
            crDB = window.indexedDB.open(dbName, dbVersion);<br />
            var db;<br />
            crDB.onerror = function (event) {<br />
                alert(&quot;Oops, There is error!&quot;, event);<br />
            }<br />
            crDB.onupgradeneeded = function (event) {<br />
                alert(&quot;That&#8217;s cool, we are upgrading&quot;);<br />
                db = event.target.result;<br />
                var objectStore = db.createObjectStore(&quot;UserName&quot;, { keyPath: &quot;UserID&quot; });<br />
            };<br />
            crDB.onsuccess = function (event) {<br />
                alert(&quot;Awesome, You have successfully Opened a Databse!&quot;);<br />
                db = event.target.result;</p>
<p>                //Creating transaction<br />
                var myTran = db.transaction([&quot;UserName&quot;], &quot;readwrite&quot;);</p>
<p>                myTran.oncomplete = function (e) {<br />
                    alert(&quot;Awesome, Transaction is successfully created!&quot;);<br />
                };</p>
<p>                myTran.onsuccess = function (e) {<br />
                    alert(&quot;Awesome, Transaction is successfully created!&quot;);<br />
                    //Adding the data<br />
                    var myObj = myTran.objectStore(&quot;UserName&quot;);</p>
<p>                    var myNames = [&quot;Sibi&quot;, &quot;Aji&quot;, &quot;Ansu&quot;, &quot;Shantu&quot;, &quot;Aghil&quot;];//Array with names</p>
<p>                    for (var i = 0; i &lt; 5; i++) {//Adding 5 objects<br />
                        myObj.add({ UserID: &#8216;SBKL0&#8217; + i, Name: myNames[i] });<br />
                    }</p>
<p>                    setTimeout(function () {<br />
                        db.transaction([&quot;UserName&quot;], &quot;readwrite&quot;).objectStore(&quot;UserName&quot;).delete(&#8216;SBKL00&#8217;);<br />
                    }, 10000);<br />
                };</p>
<p>                myTran.onerror = function (e) {<br />
                    alert(&quot;Oops, There is error!&quot;, e.message);<br />
                };</p>
<p>            }<br />
        }<br />
        $(function () {<br />
            $(&#8216;#myTab&#8217;).hide();<br />
            $(&#8216;#btnGet&#8217;).click(function () {<br />
                var get = db.transaction([&quot;UserName&quot;], &quot;readwrite&quot;).objectStore(&quot;UserName&quot;).get(&#8216;SBKL01&#8217;);<br />
                get.onsuccess = function (event) {<br />
                    alert(&quot;The name you have requested is : &quot; + get.result.Name);<br />
                };</p>
<p>            });<br />
            $(&#8216;#btnUpdate&#8217;).click(function () {<br />
                var updObject = db.transaction([&quot;UserName&quot;], &quot;readwrite&quot;).objectStore(&quot;UserName&quot;);<br />
                var upd = updObject.get(&#8216;SBKL03&#8217;);<br />
                upd.onsuccess = function (event) {<br />
                    upd.result.Name = &#8216;New Name&#8217;;<br />
                    updObject.put(upd.result);<br />
                };</p>
<p>            });<br />
            $(&#8216;#btnShow&#8217;).click(function () {<br />
                var curObject = db.transaction([&quot;UserName&quot;], &quot;readwrite&quot;).objectStore(&quot;UserName&quot;);<br />
                curObject.openCursor().onsuccess = function (event) { //Opening the cursor<br />
                    var cur = event.target.result;<br />
                    if (cur) {// Checks for the cursor<br />
                        $(&#8216;#show&#8217;).append(&#8216;&lt;tr&gt;&lt;td&gt;&#8217; + cur.key + &#8216;&lt;/td&gt;&lt;td&gt;&#8217; + cur.value.Name + &#8216;&lt;/td&gt;&lt;/tr&gt;&#8217;);<br />
                        cur.continue();<br />
                    }<br />
                };<br />
                $(&#8216;#myTab&#8217;).show();<br />
            });<br />
        });<br />
    &lt;/script&gt;<br />
    &lt;style&gt;<br />
        table, tr, td, th {<br />
            border: 1px solid #ccc;<br />
            border-radius: 5px;<br />
            padding: 10px;<br />
            margin: 10px;<br />
        }<br />
    &lt;/style&gt;<br />
&lt;/head&gt;<br />
&lt;body&gt;<br />
    &lt;input id=&quot;btnGet&quot; type=&quot;button&quot; value=&quot;Get Name&quot; /&gt;<br />
    &lt;input id=&quot;btnUpdate&quot; type=&quot;button&quot; value=&quot;Update Name&quot; /&gt;<br />
    &lt;input id=&quot;btnShow&quot; type=&quot;button&quot; value=&quot;Show the data&quot; /&gt;<br />
    &lt;div id=&quot;myTab&quot;&gt;<br />
        &lt;table id=&quot;show&quot;&gt;<br />
            &lt;thead&gt;<br />
                &lt;th&gt;User ID &lt;/th&gt;<br />
                &lt;th&gt;Name&lt;/th&gt;<br />
            &lt;/thead&gt;<br />
            &lt;tbody&gt;&lt;/tbody&gt;<br />
        &lt;/table&gt;<br />
    &lt;/div&gt;<br />
&lt;/body&gt;<br />
&lt;/html&gt;<br />
[/html]</p>
<p>That is all. We did it. Have a happy coding.
</p>
<h3>Conclusion</h3>
<p>
Did I miss anything that you may think which is needed? Did you try Web SQL yet? Have you ever wanted to do this requirement? Could you find this post as useful? I hope you liked this article. Please share me your valuable suggestions and feedback.
</p>
<h3>Your turn. What do you think?</h3>
<p>
A blog isn’t a blog without comments, but do try to stay on topic. If you have a question unrelated to this post, you’re better off posting it on C# Corner, Code Project, Stack Overflow, Asp.Net Forum instead of commenting here. Tweet or email me a link to your question there and I’ll definitely try to help if I can.
</p>
<p>Kindest Regards<br />
Sibeesh Venu</p>
]]></content:encoded>
					
					<wfw:commentRss>https://sibeeshpassion.com/introduction-to-indexeddb/feed/</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
			</item>
		<item>
		<title>Create Tooltip Without Any Plugins</title>
		<link>https://sibeeshpassion.com/create-tooltip-without-any-plugins/</link>
					<comments>https://sibeeshpassion.com/create-tooltip-without-any-plugins/#disqus_thread</comments>
		
		<dc:creator><![CDATA[SibeeshVenu]]></dc:creator>
		<pubDate>Tue, 29 Sep 2015 00:33:50 +0000</pubDate>
				<category><![CDATA[CodeProject]]></category>
		<category><![CDATA[HTML]]></category>
		<category><![CDATA[HTML5]]></category>
		<category><![CDATA[JQuery]]></category>
		<category><![CDATA[Create Tooltip Without Any Plugins]]></category>
		<category><![CDATA[JQuery mouse over]]></category>
		<category><![CDATA[JQuery Tooltip]]></category>
		<category><![CDATA[Title attribute]]></category>
		<guid isPermaLink="false">http://sibeecst_passion.com/?p=10708</guid>

					<description><![CDATA[In this post we will discuss how we can create a tool tip by using JQuery.Here we are not going to use any plugins to create the tool tip. We will use only jquery and html table for this demo. I hope you will like this. Background Recently I was going through a situation to create a tool tip for my grid. As we all know there are plenty of plugins are available for the tool tip generation. But I was not ready to go with any plugins for this. So I thought of creating it manually. You might be [&#8230;]]]></description>
										<content:encoded><![CDATA[<p>In this post we will discuss how we can create a tool tip by using <a href="http://sibeeshpassion.com/tag/JQuery/" target="_blank">JQuery</a>.Here we are not going to use any plugins to create the tool tip. We will use only jquery and html table for this demo. I hope you will like this. </p>
<p><strong>Background</strong></p>
<p>Recently I was going through a situation to create a tool tip for my grid. As we all know there are plenty of plugins are available for the tool tip generation. But I was not ready to go with any plugins for this. So I thought of creating it manually. You might be think this could be done by adding the title attribute to the elements directly, but I had a different situation. I was using a third tool, in which I was forced to include an additional js file, I was not ready to do that. Adding any unwanted js file to your project is a bad habit. So I thought of creating tool tip in the custom way. </p>
<p><strong>Using the code</strong></p>
<p>First of all we will create a page and a html table.</p>
<p>[html]<br />
&lt;!DOCTYPE html&gt;<br />
&lt;html&gt;<br />
&lt;head&gt;<br />
    &lt;title&gt;Create Tooltip Without Any Plugins&lt;/title&gt;<br />
    &lt;script src=&quot;jquery-2.0.2.min.js&quot;&gt;&lt;/script&gt;<br />
&lt;/head&gt;<br />
&lt;body&gt;<br />
    &lt;table class=&quot;table&quot; border=&quot;1&quot; style=&quot;width: 100%&quot;&gt;<br />
        &lt;tr&gt;<br />
            &lt;td&gt;Sibi&lt;/td&gt;<br />
            &lt;td&gt;Ajay&lt;/td&gt;<br />
            &lt;td&gt;50&lt;/td&gt;<br />
        &lt;/tr&gt;<br />
        &lt;tr&gt;<br />
            &lt;td&gt;Ansu&lt;/td&gt;<br />
            &lt;td&gt;Akhil&lt;/td&gt;<br />
            &lt;td&gt;94&lt;/td&gt;<br />
        &lt;/tr&gt;<br />
        &lt;tr&gt;<br />
            &lt;td&gt;Shanto&lt;/td&gt;<br />
            &lt;td&gt;Libin&lt;/td&gt;<br />
            &lt;td&gt;80&lt;/td&gt;<br />
        &lt;/tr&gt;<br />
    &lt;/table&gt;<br />
&lt;/body&gt;<br />
&lt;/html&gt;</p>
<p>[/html]</p>
<p>Now if you run your page and, you can see the table.</p>
<div id="attachment_10709" style="width: 644px" class="wp-caption alignnone"><a href="http://sibeeshpassion.com/wp-content/uploads/2015/09/Create_Tooltip_Without_Any_Plugins_1.png"><img decoding="async" aria-describedby="caption-attachment-10709" src="http://sibeeshpassion.com/wp-content/uploads/2015/09/Create_Tooltip_Without_Any_Plugins_1-1024x48.png" alt="Create Tooltip Without Any Plugins" width="634" height="30" class="size-large wp-image-10709" srcset="/wp-content/uploads/2015/09/Create_Tooltip_Without_Any_Plugins_1-1024x48.png 1024w, /wp-content/uploads/2015/09/Create_Tooltip_Without_Any_Plugins_1-300x14.png 300w, /wp-content/uploads/2015/09/Create_Tooltip_Without_Any_Plugins_1-768x36.png 768w, /wp-content/uploads/2015/09/Create_Tooltip_Without_Any_Plugins_1-400x19.png 400w, /wp-content/uploads/2015/09/Create_Tooltip_Without_Any_Plugins_1.png 634w" sizes="(max-width: 634px) 100vw, 634px" /></a><p id="caption-attachment-10709" class="wp-caption-text">Create Tooltip Without Any Plugins</p></div>
<p>No we will add our script to the page.</p>
<p>[js]<br />
 &lt;script&gt;<br />
        $(document).on(&#8216;mouseover&#8217;, &#8216;.table td&#8217;, function () {<br />
            $(this).attr(&#8216;title&#8217;, $(this).text());<br />
        });<br />
    &lt;/script&gt;<br />
[/js]</p>
<p>Here what we are doing is, we are just appending the title attribute for the td element in the mouseover event. Now run your page, and see our tool tip works perfectly. </p>
<div id="attachment_10710" style="width: 644px" class="wp-caption alignnone"><a href="http://sibeeshpassion.com/wp-content/uploads/2015/09/Create_Tooltip_Without_Any_Plugins_2.png"><img decoding="async" aria-describedby="caption-attachment-10710" src="http://sibeeshpassion.com/wp-content/uploads/2015/09/Create_Tooltip_Without_Any_Plugins_2-1024x71.png" alt="Create Tooltip Without Any Plugins" width="634" height="44" class="size-large wp-image-10710" srcset="/wp-content/uploads/2015/09/Create_Tooltip_Without_Any_Plugins_2-1024x71.png 1024w, /wp-content/uploads/2015/09/Create_Tooltip_Without_Any_Plugins_2-300x21.png 300w, /wp-content/uploads/2015/09/Create_Tooltip_Without_Any_Plugins_2-768x54.png 768w, /wp-content/uploads/2015/09/Create_Tooltip_Without_Any_Plugins_2-400x28.png 400w, /wp-content/uploads/2015/09/Create_Tooltip_Without_Any_Plugins_2.png 1332w" sizes="(max-width: 634px) 100vw, 634px" /></a><p id="caption-attachment-10710" class="wp-caption-text">Create Tooltip Without Any Plugins</p></div>
<p>We have done it finally.</p>
<p><strong>Complete Code</strong></p>
<p>[html]<br />
&lt;!DOCTYPE html&gt;<br />
&lt;html&gt;<br />
&lt;head&gt;<br />
    &lt;title&gt;Create Tooltip Without Any Plugins&lt;/title&gt;<br />
    &lt;script src=&quot;jquery-2.0.2.min.js&quot;&gt;&lt;/script&gt;<br />
    &lt;script&gt;<br />
        $(document).on(&#8216;mouseover&#8217;, &#8216;.table td&#8217;, function () {<br />
            $(this).attr(&#8216;title&#8217;, $(this).text());<br />
        });<br />
    &lt;/script&gt;<br />
&lt;/head&gt;<br />
&lt;body&gt;<br />
    &lt;table class=&quot;table&quot; border=&quot;1&quot; style=&quot;width: 100%&quot;&gt;<br />
        &lt;tr&gt;<br />
            &lt;td&gt;Sibi&lt;/td&gt;<br />
            &lt;td&gt;Ajay&lt;/td&gt;<br />
            &lt;td&gt;50&lt;/td&gt;<br />
        &lt;/tr&gt;<br />
        &lt;tr&gt;<br />
            &lt;td&gt;Ansu&lt;/td&gt;<br />
            &lt;td&gt;Akhil&lt;/td&gt;<br />
            &lt;td&gt;94&lt;/td&gt;<br />
        &lt;/tr&gt;<br />
        &lt;tr&gt;<br />
            &lt;td&gt;Shanto&lt;/td&gt;<br />
            &lt;td&gt;Libin&lt;/td&gt;<br />
            &lt;td&gt;80&lt;/td&gt;<br />
        &lt;/tr&gt;<br />
    &lt;/table&gt;<br />
&lt;/body&gt;<br />
&lt;/html&gt;</p>
<p>[/html]</p>
<p><strong>Conclusion</strong></p>
<p>Did I miss anything that you may think which is needed?Have you ever faced this issue in your programming life? I hope you liked this article. Please share me your valuable suggestions and feedback.</p>
<p><strong>Your turn. What do you think?</strong></p>
<p>A blog isn’t a blog without comments, but do try to stay on topic. If you have a question unrelated to this post, you’re better off posting it on C# Corner, Code Project, Stack Overflow, Asp.Net Forum instead of commenting here. Tweet or email me a link to your question there and I’ll definitely try to help if I am able to.</p>
<p>Kindest Regards<br />
Sibeesh Venu</p>
]]></content:encoded>
					
					<wfw:commentRss>https://sibeeshpassion.com/create-tooltip-without-any-plugins/feed/</wfw:commentRss>
			<slash:comments>4</slash:comments>
		
		
			</item>
		<item>
		<title>Check for any unsaved changes in page</title>
		<link>https://sibeeshpassion.com/check-for-any-unsaved-changes-in-page/</link>
					<comments>https://sibeeshpassion.com/check-for-any-unsaved-changes-in-page/#disqus_thread</comments>
		
		<dc:creator><![CDATA[SibeeshVenu]]></dc:creator>
		<pubDate>Tue, 29 Sep 2015 00:04:14 +0000</pubDate>
				<category><![CDATA[CodeProject]]></category>
		<category><![CDATA[HTML]]></category>
		<category><![CDATA[HTML5]]></category>
		<category><![CDATA[JQuery]]></category>
		<category><![CDATA[Check for any unsaved changes in page]]></category>
		<category><![CDATA[Show alert when there is unsaved changes]]></category>
		<guid isPermaLink="false">http://sibeecst_passion.com/?p=10714</guid>

					<description><![CDATA[In this post we will discuss how we can check for any unsaved changes in the page by using JQuery. Normally this may need to be implemented in an application where we need to give any alert if any user try to reload the page when there any unsaved changes in the page. I hope you will like this. Background I was creating a page where I have some text boxes, So I wanted to give an alert if user try to get away from the page with out saving the data entered. Using the code First of all we [&#8230;]]]></description>
										<content:encoded><![CDATA[<p>In this post we will discuss how we can check for any unsaved changes in the page by using <a href="http://sibeeshpassion.com/tag/JQuery/" target="_blank">JQuery</a>. Normally this may need to be implemented in an application where we need to give any alert if any user try to reload the page when there any unsaved changes  in the page. I hope you will like this. </p>
<p><strong>Background</strong></p>
<p>I was creating a page where I have some text boxes, So I wanted to give an alert if user try to get away from the page with out saving the data entered. </p>
<p><strong>Using the code</strong></p>
<p>First of all we will create a page and a html table.</p>
<p>[html]<br />
&lt;!DOCTYPE html&gt;<br />
&lt;html&gt;<br />
&lt;head&gt;<br />
    &lt;title&gt;Check for any unsaved changes in page&lt;/title&gt;<br />
    &lt;script src=&quot;jquery-2.0.2.min.js&quot;&gt;&lt;/script&gt;<br />
&lt;/head&gt;<br />
&lt;body&gt;<br />
    &lt;table class=&quot;table&quot; border=&quot;1&quot; style=&quot;width: 40%&quot;&gt;<br />
        &lt;tr&gt;<br />
            &lt;td&gt;Sibi&lt;/td&gt;<br />
            &lt;td&gt;Ajay&lt;/td&gt;<br />
            &lt;td&gt;&lt;input class=&quot;text&quot; type=&quot;text&quot;  /&gt;&lt;/td&gt;<br />
        &lt;/tr&gt;<br />
        &lt;tr&gt;<br />
            &lt;td&gt;Ansu&lt;/td&gt;<br />
            &lt;td&gt;Akhil&lt;/td&gt;<br />
            &lt;td&gt;&lt;input class=&quot;text&quot; type=&quot;text&quot; /&gt;&lt;/td&gt;<br />
        &lt;/tr&gt;<br />
        &lt;tr&gt;<br />
            &lt;td&gt;Shanto&lt;/td&gt;<br />
            &lt;td&gt;Libin&lt;/td&gt;<br />
            &lt;td&gt;&lt;input class=&quot;text&quot; type=&quot;text&quot; /&gt;&lt;/td&gt;<br />
        &lt;/tr&gt;<br />
    &lt;/table&gt;<br />
&lt;/body&gt;<br />
&lt;/html&gt;</p>
<p>[/html]</p>
<p>Now if you run your page and, you can see the table.</p>
<div id="attachment_10716" style="width: 660px" class="wp-caption alignnone"><a href="http://sibeeshpassion.com/wp-content/uploads/2015/09/Check_for_any_unsaved_changes_in_page_11-e1443423241572.png"><img decoding="async" aria-describedby="caption-attachment-10716" src="http://sibeeshpassion.com/wp-content/uploads/2015/09/Check_for_any_unsaved_changes_in_page_11-e1443423241572.png" alt="Check for any unsaved changes in page" width="650" height="83" class="size-full wp-image-10716" srcset="/wp-content/uploads/2015/09/Check_for_any_unsaved_changes_in_page_11-e1443423241572.png 650w, /wp-content/uploads/2015/09/Check_for_any_unsaved_changes_in_page_11-e1443423241572-300x38.png 300w, /wp-content/uploads/2015/09/Check_for_any_unsaved_changes_in_page_11-e1443423241572-400x51.png 400w" sizes="(max-width: 650px) 100vw, 650px" /></a><p id="caption-attachment-10716" class="wp-caption-text">Check for any unsaved changes in page</p></div>
<p>No we will create a bool variable which will be true when there is an unsaved data.</p>
<p>[js]<br />
var unsaved = false;<br />
[/js]</p>
<p>What next? We will add call to an existing function when user reloads the page. Sounds good?</p>
<p>[js]<br />
window.onbeforeunload = unloadPage;<br />
[/js]</p>
<p>As you can see we are calling a function <em>unloadPage</em>, preceding is the function definition.</p>
<p>[js]<br />
 function unloadPage() {<br />
            if (unsaved) {<br />
                return &quot;You have unsaved changes on this page.&quot;;<br />
            }<br />
        }<br />
[/js]</p>
<p>Now please run your page and type anything in the text box given, then reload your page.<br />
You will get an alert of <em>You have unsaved changes on this page.</em>. Shall we check that?</p>
<div id="attachment_10717" style="width: 660px" class="wp-caption alignnone"><a href="http://sibeeshpassion.com/wp-content/uploads/2015/09/Check_for_any_unsaved_changes_in_page_2-e1443423675762.png"><img decoding="async" aria-describedby="caption-attachment-10717" src="http://sibeeshpassion.com/wp-content/uploads/2015/09/Check_for_any_unsaved_changes_in_page_2-e1443423675762.png" alt="Check for any unsaved changes in page" width="650" height="260" class="size-full wp-image-10717" srcset="/wp-content/uploads/2015/09/Check_for_any_unsaved_changes_in_page_2-e1443423675762.png 650w, /wp-content/uploads/2015/09/Check_for_any_unsaved_changes_in_page_2-e1443423675762-300x120.png 300w, /wp-content/uploads/2015/09/Check_for_any_unsaved_changes_in_page_2-e1443423675762-400x160.png 400w" sizes="(max-width: 650px) 100vw, 650px" /></a><p id="caption-attachment-10717" class="wp-caption-text">Check for any unsaved changes in page</p></div>
<p>We have done it finally.</p>
<p><strong>Complete Code</strong></p>
<p>[html]<br />
&lt;!DOCTYPE html&gt;<br />
&lt;html&gt;<br />
&lt;head&gt;<br />
    &lt;title&gt;Check for any unsaved changes in page&lt;/title&gt;<br />
    &lt;script src=&quot;jquery-2.0.2.min.js&quot;&gt;&lt;/script&gt;<br />
    &lt;script&gt;<br />
        var unsaved = false;<br />
        $(document).on(&#8216;change&#8217;, &#8216;.table .text&#8217;, function () {<br />
            unsaved = true;<br />
        });</p>
<p>        $(document).on(&#8216;mouseover&#8217;, &#8216;.table td&#8217;, function () {<br />
            $(this).attr(&#8216;title&#8217;, $(this).text());<br />
        });<br />
        function unloadPage() {<br />
            if (unsaved) {<br />
                return &quot;You have unsaved changes on this page.&quot;;<br />
            }<br />
        }<br />
        window.onbeforeunload = unloadPage;<br />
    &lt;/script&gt;<br />
&lt;/head&gt;<br />
&lt;body&gt;<br />
    &lt;table class=&quot;table&quot; border=&quot;1&quot; style=&quot;width: 40%&quot;&gt;<br />
        &lt;tr&gt;<br />
            &lt;td&gt;Sibi&lt;/td&gt;<br />
            &lt;td&gt;Ajay&lt;/td&gt;<br />
            &lt;td&gt;<br />
                &lt;input class=&quot;text&quot; type=&quot;text&quot; /&gt;&lt;/td&gt;<br />
        &lt;/tr&gt;<br />
        &lt;tr&gt;<br />
            &lt;td&gt;Ansu&lt;/td&gt;<br />
            &lt;td&gt;Akhil&lt;/td&gt;<br />
            &lt;td&gt;<br />
                &lt;input class=&quot;text&quot; type=&quot;text&quot; /&gt;&lt;/td&gt;<br />
        &lt;/tr&gt;<br />
        &lt;tr&gt;<br />
            &lt;td&gt;Shanto&lt;/td&gt;<br />
            &lt;td&gt;Libin&lt;/td&gt;<br />
            &lt;td&gt;<br />
                &lt;input class=&quot;text&quot; type=&quot;text&quot; /&gt;&lt;/td&gt;<br />
        &lt;/tr&gt;<br />
    &lt;/table&gt;<br />
&lt;/body&gt;<br />
&lt;/html&gt;</p>
<p>[/html]</p>
<p><strong>Conclusion</strong></p>
<p>Did I miss anything that you may think which is needed? Have you ever faced this requirement in your programming life? Does this article helps you in anyway? I hope you liked this article. Please share me your valuable suggestions and feedback.</p>
<p><strong>Your turn. What do you think?</strong></p>
<p>A blog isn’t a blog without comments, but do try to stay on topic. If you have a question unrelated to this post, you’re better off posting it on C# Corner, Code Project, Stack Overflow, Asp.Net Forum instead of commenting here. Tweet or email me a link to your question there and I’ll definitely try to help if I can. Have a happy coding!.</p>
<p>Kindest Regards<br />
Sibeesh Venu</p>
]]></content:encoded>
					
					<wfw:commentRss>https://sibeeshpassion.com/check-for-any-unsaved-changes-in-page/feed/</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
			</item>
		<item>
		<title>Remove Filtered sessionStorage And localStorage</title>
		<link>https://sibeeshpassion.com/remove-filtered-sessionstorage-and-localstorage/</link>
					<comments>https://sibeeshpassion.com/remove-filtered-sessionstorage-and-localstorage/#disqus_thread</comments>
		
		<dc:creator><![CDATA[SibeeshVenu]]></dc:creator>
		<pubDate>Tue, 11 Aug 2015 00:32:47 +0000</pubDate>
				<category><![CDATA[HTML5]]></category>
		<category><![CDATA[Storage In HTML5]]></category>
		<category><![CDATA[Find Out Particular Local Storage And Delete]]></category>
		<category><![CDATA[Find Out Particular Session Storage And Delete]]></category>
		<category><![CDATA[Local Storage]]></category>
		<category><![CDATA[Remove Filtered sessionStorage And localStorage]]></category>
		<category><![CDATA[Remove Local Storage]]></category>
		<category><![CDATA[Remove session storage]]></category>
		<category><![CDATA[Session Storage]]></category>
		<category><![CDATA[Storage in HTML5]]></category>
		<guid isPermaLink="false">http://sibeecst_passion.com/?p=8541</guid>

					<description><![CDATA[[toc] Introduction In this post we well discuss how to remove all local storage and session storage or remove the storage according to the key values, for example, is a key contain a particular string, we will remove that local storage and session storage. We will find all the local storage and session storage first and then we will loop through each, if a user needs to delete a particular storage according to a particular condition, we will delete that storage alone. Both localStorage and sessionStorage has been introduced with HTML5. If you are new to storage mechanism in client [&#8230;]]]></description>
										<content:encoded><![CDATA[<p>[toc]</p>
<h3>Introduction</h3>
<p>
In this post we well discuss how to remove all local storage and session storage or remove the storage according to the key values, for example, is a key contain a particular string, we will remove that local storage and session storage. We will find all the local storage and session storage first and then we will loop through each, if a user needs to delete a particular storage according to a particular condition, we will delete that storage alone. </p>
<p>Both <em>localStorage</em> and <em>sessionStorage </em>has been introduced with HTML5. If you are new to storage mechanism in client side, you can find out here: <a href="http://sibeeshpassion.com/tag/storage-in-html5/" target="_blank">Storage In HTML5</a>
</p>
<h3>Backgroud</h3>
<p>
I am working in a client-side application where we use <em>localStorage</em> and <em>sessionStorage </em> for saving some key informations. What I mean by key information is, like we store the mail id of the user who uses the application. There I got a requirement of deleting the <em>localStorage</em> and <em>sessionStorage </em> according to the key value. For example, I needed to delete the storage values whose keys start with &#8220;logged&#8221;. I did the requirement and thought to share with you all. I hope someone will find it is useful.
</p>
<h3>Using the code</h3>
<p>
To start with you need to include jquery reference.</p>
<p>[js]<br />
 &lt;script src=&quot;https://code.jquery.com/jquery-2.1.4.min.js&quot;&gt;&lt;/script&gt;<br />
[/js]</p>
<p>Now we need to set the <em>localStorage</em> and <em>sessionStorage </em> right? </p>
<p>Add the storage values in the ready event.</p>
<p>[js]<br />
localStorage.setItem(&quot;First1&quot;,&quot;First Local Storage&quot;);<br />
			sessionStorage.setItem(&quot;First1&quot;,&quot;First Session Storage&quot;);<br />
			localStorage.setItem(&quot;Second1&quot;,&quot;Second Local Storage&quot;);<br />
			sessionStorage.setItem(&quot;Second1&quot;,&quot;Second Session Storage&quot;);<br />
[/js]</p>
<p>So we have set our <em>localStorage</em> and <em>sessionStorage </em>. Now we need to check whether it is saved or not right? Just run your page and see your browser console.</p>
<p><a href="http://sibeeshpassion.com/wp-content/uploads/2015/08/Remove_Filtered_sessionStorage_And_localStorage1.png"><img decoding="async" src="http://sibeeshpassion.com/wp-content/uploads/2015/08/Remove_Filtered_sessionStorage_And_localStorage1-1024x256.png" alt="Remove_Filtered_sessionStorage_And_localStorage1" width="634" height="159" class="alignnone size-large wp-image-8551" srcset="/wp-content/uploads/2015/08/Remove_Filtered_sessionStorage_And_localStorage1-1024x256.png 1024w, /wp-content/uploads/2015/08/Remove_Filtered_sessionStorage_And_localStorage1-300x75.png 300w, /wp-content/uploads/2015/08/Remove_Filtered_sessionStorage_And_localStorage1-768x192.png 768w, /wp-content/uploads/2015/08/Remove_Filtered_sessionStorage_And_localStorage1-400x100.png 400w, /wp-content/uploads/2015/08/Remove_Filtered_sessionStorage_And_localStorage1.png 634w" sizes="(max-width: 634px) 100vw, 634px" /></a></p>
<p><a href="http://sibeeshpassion.com/wp-content/uploads/2015/08/Remove_Filtered_sessionStorage_And_localStorage2-e1438859495855.png"><img decoding="async" src="http://sibeeshpassion.com/wp-content/uploads/2015/08/Remove_Filtered_sessionStorage_And_localStorage2-e1438859495855.png" alt="Remove_Filtered_sessionStorage_And_localStorage2" width="650" height="177" class="alignnone size-full wp-image-8561" srcset="/wp-content/uploads/2015/08/Remove_Filtered_sessionStorage_And_localStorage2-e1438859495855.png 650w, /wp-content/uploads/2015/08/Remove_Filtered_sessionStorage_And_localStorage2-e1438859495855-300x82.png 300w, /wp-content/uploads/2015/08/Remove_Filtered_sessionStorage_And_localStorage2-e1438859495855-400x109.png 400w" sizes="(max-width: 650px) 100vw, 650px" /></a></p>
<p>Now we will add some elements where we can fire the delete events. Cool?</p>
<p>[html]<br />
 &lt;a href=&quot;#&quot; id=&quot;removeAllLocalStorage&quot;&gt;Click To Remove All Local Storage&lt;/a&gt;&lt;br/&gt;&lt;br/&gt;<br />
   &lt;a href=&quot;#&quot; id=&quot;removeAllLocalStorageWhichStarts&quot;&gt;Click To Remove All Local Storage Which Starts With &quot;First&quot;&lt;/a&gt;&lt;br/&gt;&lt;br/&gt;<br />
   &lt;a href=&quot;#&quot; id=&quot;removeAllSessionStorage&quot;&gt;Click To Remove All Session Storage&lt;/a&gt;&lt;br/&gt;&lt;br/&gt;<br />
   &lt;a href=&quot;#&quot; id=&quot;removeAllSessionStorageWhichStarts&quot;&gt;Click To Remove All Session Storage Which Starts With &quot;First&quot;&lt;/a&gt;&lt;br/&gt;&lt;br/&gt;<br />
[/html]</p>
<p>Once that is done, we add the click event scripts.</p>
<p>[js]<br />
 &lt;script&gt;<br />
       $(document).ready(function(){<br />
			localStorage.setItem(&quot;First1&quot;,&quot;First Local Storage&quot;);<br />
			sessionStorage.setItem(&quot;First1&quot;,&quot;First Session Storage&quot;);<br />
			localStorage.setItem(&quot;Second1&quot;,&quot;Second Local Storage&quot;);<br />
			sessionStorage.setItem(&quot;Second1&quot;,&quot;Second Session Storage&quot;);</p>
<p>            $(&quot;#removeAllLocalStorage&quot;).click(function(){<br />
				Object.keys(localStorage)<br />
				.forEach(function (key) {<br />
						localStorage.removeItem(key);<br />
				});<br />
            });<br />
			$(&quot;#removeAllLocalStorageWhichStarts&quot;).click(function(){<br />
				Object.keys(localStorage)<br />
				.forEach(function (key) {<br />
						if ((/^First/.test(key))) {<br />
							localStorage.removeItem(key);<br />
						}<br />
				});<br />
            });<br />
			$(&quot;#removeAllSessionStorage&quot;).click(function(){<br />
				Object.keys(sessionStorage)<br />
				.forEach(function (key) {<br />
						sessionStorage.removeItem(key);<br />
				});<br />
            });<br />
			$(&quot;#removeAllSessionStorageWhichStarts&quot;).click(function(){<br />
				Object.keys(sessionStorage)<br />
				.forEach(function (key) {<br />
						if ((/^First/.test(key))) {<br />
							sessionStorage.removeItem(key);<br />
						}<br />
				});<br />
            });<br />
       });<br />
      &lt;/script&gt;<br />
[/js]	 </p>
<p>So everything is set. Now the only pending thing is just run and see the output. </p>
<p>First, we will fire the click event which removes all the local storage. ok? </p>
<p><a href="http://sibeeshpassion.com/wp-content/uploads/2015/08/Remove_Filtered_sessionStorage_And_localStorage3-e1438859851133.png"><img decoding="async" src="http://sibeeshpassion.com/wp-content/uploads/2015/08/Remove_Filtered_sessionStorage_And_localStorage3-e1438859851133.png" alt="Remove_Filtered_sessionStorage_And_localStorage3" width="650" height="266" class="alignnone size-full wp-image-8581" srcset="/wp-content/uploads/2015/08/Remove_Filtered_sessionStorage_And_localStorage3-e1438859851133.png 650w, /wp-content/uploads/2015/08/Remove_Filtered_sessionStorage_And_localStorage3-e1438859851133-300x123.png 300w, /wp-content/uploads/2015/08/Remove_Filtered_sessionStorage_And_localStorage3-e1438859851133-400x164.png 400w" sizes="(max-width: 650px) 100vw, 650px" /></a></p>
<p>Once you clicked, you can see all of your local storage items have been removed.</p>
<p><a href="http://sibeeshpassion.com/wp-content/uploads/2015/08/Remove_Filtered_sessionStorage_And_localStorage4-e1438859935922.png"><img decoding="async" src="http://sibeeshpassion.com/wp-content/uploads/2015/08/Remove_Filtered_sessionStorage_And_localStorage4-e1438859935922.png" alt="Remove_Filtered_sessionStorage_And_localStorage4" width="650" height="102" class="alignnone size-full wp-image-8591" srcset="/wp-content/uploads/2015/08/Remove_Filtered_sessionStorage_And_localStorage4-e1438859935922.png 650w, /wp-content/uploads/2015/08/Remove_Filtered_sessionStorage_And_localStorage4-e1438859935922-300x47.png 300w, /wp-content/uploads/2015/08/Remove_Filtered_sessionStorage_And_localStorage4-e1438859935922-400x63.png 400w" sizes="(max-width: 650px) 100vw, 650px" /></a></p>
<p>Now we will reload the page and set the storage items again, this time we will fire the event which delete the local storage value which has key starts with &#8220;First&#8221;.</p>
<p><a href="http://sibeeshpassion.com/wp-content/uploads/2015/08/Remove_Filtered_sessionStorage_And_localStorage5-e1438860090376.png"><img decoding="async" src="http://sibeeshpassion.com/wp-content/uploads/2015/08/Remove_Filtered_sessionStorage_And_localStorage5-e1438860090376.png" alt="Remove_Filtered_sessionStorage_And_localStorage5" width="650" height="264" class="alignnone size-full wp-image-8601" srcset="/wp-content/uploads/2015/08/Remove_Filtered_sessionStorage_And_localStorage5-e1438860090376.png 650w, /wp-content/uploads/2015/08/Remove_Filtered_sessionStorage_And_localStorage5-e1438860090376-300x122.png 300w, /wp-content/uploads/2015/08/Remove_Filtered_sessionStorage_And_localStorage5-e1438860090376-400x162.png 400w" sizes="(max-width: 650px) 100vw, 650px" /></a></p>
<p>Once you clicked you can see only the storage element which has key starts with &#8220;First&#8221; has been removed.</p>
<p><a href="http://sibeeshpassion.com/wp-content/uploads/2015/08/Remove_Filtered_sessionStorage_And_localStorage6-e1438860182653.png"><img decoding="async" src="http://sibeeshpassion.com/wp-content/uploads/2015/08/Remove_Filtered_sessionStorage_And_localStorage6-e1438860182653.png" alt="Remove_Filtered_sessionStorage_And_localStorage6" width="650" height="101" class="alignnone size-full wp-image-8611" srcset="/wp-content/uploads/2015/08/Remove_Filtered_sessionStorage_And_localStorage6-e1438860182653.png 650w, /wp-content/uploads/2015/08/Remove_Filtered_sessionStorage_And_localStorage6-e1438860182653-300x47.png 300w, /wp-content/uploads/2015/08/Remove_Filtered_sessionStorage_And_localStorage6-e1438860182653-400x62.png 400w" sizes="(max-width: 650px) 100vw, 650px" /></a></p>
<p>Next, we will fire the click event which removes all the session storage. ok? </p>
<p><a href="http://sibeeshpassion.com/wp-content/uploads/2015/08/Remove_Filtered_sessionStorage_And_localStorage7-e1438860272461.png"><img decoding="async" src="http://sibeeshpassion.com/wp-content/uploads/2015/08/Remove_Filtered_sessionStorage_And_localStorage7-e1438860272461.png" alt="Remove_Filtered_sessionStorage_And_localStorage7" width="650" height="285" class="alignnone size-full wp-image-8621" srcset="/wp-content/uploads/2015/08/Remove_Filtered_sessionStorage_And_localStorage7-e1438860272461.png 650w, /wp-content/uploads/2015/08/Remove_Filtered_sessionStorage_And_localStorage7-e1438860272461-300x132.png 300w, /wp-content/uploads/2015/08/Remove_Filtered_sessionStorage_And_localStorage7-e1438860272461-400x175.png 400w" sizes="(max-width: 650px) 100vw, 650px" /></a></p>
<p>Once you clicked, you can see all of your session storage items have been removed.</p>
<p><a href="http://sibeeshpassion.com/wp-content/uploads/2015/08/Remove_Filtered_sessionStorage_And_localStorage8-e1438860363488.png"><img decoding="async" src="http://sibeeshpassion.com/wp-content/uploads/2015/08/Remove_Filtered_sessionStorage_And_localStorage8-e1438860363488.png" alt="Remove_Filtered_sessionStorage_And_localStorage8" width="650" height="121" class="alignnone size-full wp-image-8631" srcset="/wp-content/uploads/2015/08/Remove_Filtered_sessionStorage_And_localStorage8-e1438860363488.png 650w, /wp-content/uploads/2015/08/Remove_Filtered_sessionStorage_And_localStorage8-e1438860363488-300x56.png 300w, /wp-content/uploads/2015/08/Remove_Filtered_sessionStorage_And_localStorage8-e1438860363488-400x74.png 400w" sizes="(max-width: 650px) 100vw, 650px" /></a></p>
<p>Now we will reload the page and set the storage items again, this time we will fire the event which deletes the session storage value which has key starts with &#8220;First&#8221;.</p>
<p><a href="http://sibeeshpassion.com/wp-content/uploads/2015/08/Remove_Filtered_sessionStorage_And_localStorage9-e1438860452170.png"><img decoding="async" src="http://sibeeshpassion.com/wp-content/uploads/2015/08/Remove_Filtered_sessionStorage_And_localStorage9-e1438860452170.png" alt="Remove_Filtered_sessionStorage_And_localStorage9" width="650" height="280" class="alignnone size-full wp-image-8641" srcset="/wp-content/uploads/2015/08/Remove_Filtered_sessionStorage_And_localStorage9-e1438860452170.png 650w, /wp-content/uploads/2015/08/Remove_Filtered_sessionStorage_And_localStorage9-e1438860452170-300x129.png 300w, /wp-content/uploads/2015/08/Remove_Filtered_sessionStorage_And_localStorage9-e1438860452170-400x172.png 400w" sizes="(max-width: 650px) 100vw, 650px" /></a></p>
<p>Once you clicked you can see only the session storage element which has key starts with &#8220;First&#8221; has been removed.</p>
<p><a href="http://sibeeshpassion.com/wp-content/uploads/2015/08/Remove_Filtered_sessionStorage_And_localStorage10-e1438860535759.png"><img decoding="async" src="http://sibeeshpassion.com/wp-content/uploads/2015/08/Remove_Filtered_sessionStorage_And_localStorage10-e1438860535759.png" alt="Remove_Filtered_sessionStorage_And_localStorage10" width="650" height="126" class="alignnone size-full wp-image-8651" srcset="/wp-content/uploads/2015/08/Remove_Filtered_sessionStorage_And_localStorage10-e1438860535759.png 650w, /wp-content/uploads/2015/08/Remove_Filtered_sessionStorage_And_localStorage10-e1438860535759-300x58.png 300w, /wp-content/uploads/2015/08/Remove_Filtered_sessionStorage_And_localStorage10-e1438860535759-400x78.png 400w" sizes="(max-width: 650px) 100vw, 650px" /></a></p>
<p>So we have done everything.
</p>
<h3>Complete Code</h3>
<p>
[html]<br />
&lt;html&gt;<br />
   &lt;head&gt;<br />
      &lt;title&gt;Remove all session storage,local storage or remove by key which starts with a particular string &#8211; Sibeesh Passion&lt;/title&gt;<br />
      &lt;script src=&quot;https://code.jquery.com/jquery-2.1.4.min.js&quot;&gt;&lt;/script&gt;<br />
   &lt;/head&gt;<br />
   &lt;body&gt;<br />
   &lt;a href=&quot;#&quot; id=&quot;removeAllLocalStorage&quot;&gt;Click To Remove All Local Storage&lt;/a&gt;&lt;br/&gt;&lt;br/&gt;<br />
   &lt;a href=&quot;#&quot; id=&quot;removeAllLocalStorageWhichStarts&quot;&gt;Click To Remove All Local Storage Which Starts With &quot;First&quot;&lt;/a&gt;&lt;br/&gt;&lt;br/&gt;<br />
   &lt;a href=&quot;#&quot; id=&quot;removeAllSessionStorage&quot;&gt;Click To Remove All Session Storage&lt;/a&gt;&lt;br/&gt;&lt;br/&gt;<br />
   &lt;a href=&quot;#&quot; id=&quot;removeAllSessionStorageWhichStarts&quot;&gt;Click To Remove All Session Storage Which Starts With &quot;First&quot;&lt;/a&gt;&lt;br/&gt;&lt;br/&gt;<br />
   &lt;div id=&quot;body&quot;&gt;&lt;/div&gt;<br />
      &lt;script&gt;<br />
       $(document).ready(function(){<br />
			localStorage.setItem(&quot;First1&quot;,&quot;First Local Storage&quot;);<br />
			sessionStorage.setItem(&quot;First1&quot;,&quot;First Session Storage&quot;);<br />
			localStorage.setItem(&quot;Second1&quot;,&quot;Second Local Storage&quot;);<br />
			sessionStorage.setItem(&quot;Second1&quot;,&quot;Second Session Storage&quot;);</p>
<p>            $(&quot;#removeAllLocalStorage&quot;).click(function(){<br />
				Object.keys(localStorage)<br />
				.forEach(function (key) {<br />
						localStorage.removeItem(key);<br />
				});<br />
            });<br />
			$(&quot;#removeAllLocalStorageWhichStarts&quot;).click(function(){<br />
				Object.keys(localStorage)<br />
				.forEach(function (key) {<br />
						if ((/^First/.test(key))) {<br />
							localStorage.removeItem(key);<br />
						}<br />
				});<br />
            });<br />
			$(&quot;#removeAllSessionStorage&quot;).click(function(){<br />
				Object.keys(sessionStorage)<br />
				.forEach(function (key) {<br />
						sessionStorage.removeItem(key);<br />
				});<br />
            });<br />
			$(&quot;#removeAllSessionStorageWhichStarts&quot;).click(function(){<br />
				Object.keys(sessionStorage)<br />
				.forEach(function (key) {<br />
						if ((/^First/.test(key))) {<br />
							sessionStorage.removeItem(key);<br />
						}<br />
				});<br />
            });<br />
       });<br />
      &lt;/script&gt;</p>
<p>   &lt;/body&gt;<br />
&lt;/html&gt;<br />
[/html]
</p>
<h3>Conclusion</h3>
<p>
Thanks a lot for reading. Did I miss anything that you may think which is needed? Could you find this post as useful? I hope you liked this article. Please share me your valuable suggestions and feedback.
</p>
<h3>Your turn. What do you think?</h3>
<p>
A blog isn’t a blog without comments, but do try to stay on topic. If you have a question unrelated to this post, you’re better off posting it on C# Corner, Code Project, Stack Overflow, Asp.Net Forum instead of commenting here. Tweet or email me a link to your question there and I’ll definitely try to help if I can.
</p>
<p>Kindest Regards<br />
Sibeesh Venu</p>
]]></content:encoded>
					
					<wfw:commentRss>https://sibeeshpassion.com/remove-filtered-sessionstorage-and-localstorage/feed/</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
			</item>
		<item>
		<title>Working With Client Side Local Storage</title>
		<link>https://sibeeshpassion.com/working-with-client-side-local-storage/</link>
					<comments>https://sibeeshpassion.com/working-with-client-side-local-storage/#disqus_thread</comments>
		
		<dc:creator><![CDATA[SibeeshVenu]]></dc:creator>
		<pubDate>Mon, 03 Aug 2015 00:09:38 +0000</pubDate>
				<category><![CDATA[CodeProject]]></category>
		<category><![CDATA[HTML5]]></category>
		<category><![CDATA[Local Storage]]></category>
		<category><![CDATA[Storage in HTML5]]></category>
		<guid isPermaLink="false">https://sibeeshpassion.com/?p=1411</guid>

					<description><![CDATA[[toc] Introduction In this article, we will learn how to use local storage in HTML5. For many years, we developers were depending on the server only for saving the data. And we used to retrieve the data by sending a request to our server and by manipulating some queries we could manage the formation, updating, insertion and so on. Great, we were doing a fantastic job. But as the day’s passes, we must move on to the next level. Nowadays all are busy in their life, so a person can wait a maximum of a few seconds for a request [&#8230;]]]></description>
										<content:encoded><![CDATA[<p>[toc]</p>
<h3>Introduction</h3>
<p>
In this article, we will learn how to use local storage in HTML5. For many years, we developers were depending on the server only for saving the data. And we used to retrieve the data by sending a request to our server and by manipulating some queries we could manage the formation, updating, insertion and so on. Great, we were doing a fantastic job.</p>
<p>But as the day’s passes, we must move on to the next level. Nowadays all are busy in their life, so a person can wait a maximum of a few seconds for a request that he has given in your blog, or website, or in your product. If it takes much time, he/she will just close the window and start searching for an alternative. Am I right?</p>
<p>Yeah, it happens when you are depending completely on the server. For each query, it will take some seconds. Just because of this, we started using the client-side state management techniques, mostly cookies.</p>
<p>But we do have the following issues if we are using cookies also:</p>
<p>The cookies can have only a limited amount of data, which is definitely not enough for us to work on (4096 bytes).<br />
And as the number of requests increases, the data amount in cookies also increase. So at a point in time, we may encounter some performance issues. So in the modern web, we have a new solution, Local Storage.
</p>
<h3>Source Code</h3>
<p>Download the source code here: <a href="https://code.msdn.microsoft.com/Client-Side-Local-Storage-1db5f707" target="_blank">Local Storage </a></p>
<h3>Background</h3>
<p>Currently, I am working on a dashboard application. As you all know a dashboard application must be as fast as possible. It must not make a user wait. So most of our codes are on the client side. So we are storing the necessary data on the client side itself, that makes my app fast. And we are using jQuery.</p>
<h3>Using the code</h3>
<p>Now we will work on how to save the data in local storage and retrieve it when we need it.</p>
<h4>Saving the Data</h4>
<p>To save the data we do have a function called <em>setItem().</em> We can use the following syntax.</p>
<p>[js]<br />
localStorage.setItem(“item”, “http://sibeeshpassion.com/”)<br />
[/js]</p>
<p>Before going for this, you must check that your browser supports this feature since this is only applicable to modern browsers.</p>
<h4>To check whether it supports it or not:</h4>
<p>[js]<br />
if (localStorage) {<br />
}<br />
else {<br />
$(“#showitem”).text(“your browser does not support this feature”);<br />
}<br />
[/js]</p>
<h4>Retrieving the data from local storage</h4>
<p>We can use the <em>getItem() </em>function to retrieve the data from the local storage.</p>
<p>Please see the following syntax.<br />
[js]<br />
var itm = localStorage.getItem(“item”);<br />
[/js]</p>
<p>Great, you have it. Congratulations.</p>
<p>Now we will work on how to remove this item from local storage.</p>
<h4>Removing data from the local storage</h4>
<p>To remove the data form the local storage, please see the following syntax.<br />
[js]<br />
localStorage.removeItem(“item”);<br />
[/js]</p>
<h4>Removing the all data from localStorage</h4>
<p>To remove the data form the localStorage, please see the following syntax.<br />
[js]<br />
localStorage.clear();<br />
[/js]</p>
<h3>Demo</h3>
<p>Here we will create 3 buttons and one h2 tag as in the following markup.</p>
<p>[html]<br />
&lt;input type=“submit” id=“setitem” value=“set Item” /&gt;<br />
&lt;input type=“submit” id=“getitem” value=“get Item” /&gt;<br />
&lt;input type=“submit” id=“removeitem” value=“remove Item” /&gt;<br />
&lt;h2 id=“showitem”&gt;&lt;/h2&gt;<br />
[/html]</p>
<p>Now we will add the jQuery reference.</p>
<p>[js]<br />
&lt;script src=“jquery-1.11.1.min.js”&gt;&lt;/script&gt;<br />
[/js]</p>
<h4>Set the Item</h4>
<p>[js]<br />
$(“#setitem”).click(function () {<br />
localStorage.setItem(“item”, “http://sibeeshpassion.com/”)<br />
});<br />
[/js]</p>
<p>Once you set the item to localStorage, you can see it in your browser. To see it, press F12 after pressing the set Item button, then go to the resources tab.</p>
<p>Figure: Prior to setting the item</p>
<p><a href="http://sibeeshpassion.com/wp-content/uploads/2015/03/set_items_to_local_storage.jpg"><img decoding="async" src="http://sibeeshpassion.com/wp-content/uploads/2015/03/set_items_to_local_storage.jpg" alt="set_items_to_local_storage" width="611" height="265" class="alignnone size-full wp-image-8501" srcset="/wp-content/uploads/2015/03/set_items_to_local_storage.jpg 611w, /wp-content/uploads/2015/03/set_items_to_local_storage-300x130.jpg 300w, /wp-content/uploads/2015/03/set_items_to_local_storage-400x173.jpg 400w" sizes="(max-width: 611px) 100vw, 611px" /></a></p>
<p>Figure: After setting the item</p>
<p><a href="http://sibeeshpassion.com/wp-content/uploads/2015/03/set_items_to_local_storage1.jpg"><img decoding="async" src="http://sibeeshpassion.com/wp-content/uploads/2015/03/set_items_to_local_storage1.jpg" alt="set_items_to_local_storage1" width="692" height="297" class="alignnone size-full wp-image-8511" srcset="/wp-content/uploads/2015/03/set_items_to_local_storage1.jpg 634w, /wp-content/uploads/2015/03/set_items_to_local_storage1-300x129.jpg 300w, /wp-content/uploads/2015/03/set_items_to_local_storage1-400x172.jpg 400w" sizes="(max-width: 692px) 100vw, 692px" /></a></p>
<h4>Get the Item</h4>
<p>[js]<br />
$(“#getitem”).click(function () {<br />
                    var itm = localStorage.getItem(“item”)<br />
                    $(“#showitem”).text(itm);<br />
                });<br />
[/js]</p>
<h4>Remove the Item</h4>
<p>[js]<br />
$(“#removeitem”).click(function () {<br />
                    localStorage.removeItem(“item”);<br />
                    $(“#showitem”).text(”);<br />
                });<br />
[/js]</p>
<h3>Complete Code</h3>
<p>[html]<br />
&lt;!DOCTYPE html&gt;<br />
&lt;html xmlns=“http://www.w3.org/1999/xhtml”&gt;<br />
&lt;head&gt;<br />
    &lt;title&gt;Use Of Local Storage – Sibeesh|Passion&lt;/title&gt;<br />
    &lt;script src=“jquery-1.11.1.min.js”&gt;&lt;/script&gt;<br />
    &lt;script&gt;<br />
        $(function () {<br />
            if (localStorage) {<br />
                $(“#setitem”).click(function () {<br />
                    localStorage.setItem(“item”, “http://sibeeshpassion.com/”)<br />
                });<br />
                $(“#getitem”).click(function () {<br />
                    var itm = localStorage.getItem(“item”)<br />
                    $(“#showitem”).text(itm);<br />
                });<br />
                $(“#removeitem”).click(function () {<br />
                    localStorage.removeItem(“item”);<br />
                    $(“#showitem”).text(”);<br />
                });<br />
            }<br />
            else {<br />
                $(“#showitem”).text(“your browser does not support this feature”);<br />
            }<br />
        });<br />
&lt;/script&gt;<br />
&lt;/head&gt;<br />
&lt;body&gt;<br />
    &lt;input type=“submit” id=“setitem” value=“set Item” /&gt;<br />
    &lt;input type=“submit” id=“getitem” value=“get Item” /&gt;<br />
    &lt;input type=“submit” id=“removeitem” value=“remove Item” /&gt;<br />
    &lt;h2 id=“showitem”&gt;&lt;/h2&gt;<br />
&lt;/body&gt;<br />
&lt;/html&gt;<br />
[/html]</p>
<h3>Conclusion</h3>
<p>Thanks a lot for reading. Did I miss anything that you may think which is needed? Could you find this post as useful? I hope you liked this article. Please share me your valuable suggestions and feedback.</p>
<h3>Your turn. What do you think?</h3>
<p>A blog isn’t a blog without comments, but do try to stay on topic. If you have a question unrelated to this post, you’re better off posting it on C# Corner, Code Project, Stack Overflow, Asp.Net Forum instead of commenting here. Tweet or email me a link to your question there and I’ll definitely try to help if I can.</p>
<p>Kindest Regards<br />
Sibeesh Venu</p>
]]></content:encoded>
					
					<wfw:commentRss>https://sibeeshpassion.com/working-with-client-side-local-storage/feed/</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
			</item>
		<item>
		<title>Client Side Chart Widget in HTML5: Part 5 (Polar Area Chart)</title>
		<link>https://sibeeshpassion.com/client-side-chart-widget-in-html5-part-5-polar-area-chart/</link>
					<comments>https://sibeeshpassion.com/client-side-chart-widget-in-html5-part-5-polar-area-chart/#disqus_thread</comments>
		
		<dc:creator><![CDATA[SibeeshVenu]]></dc:creator>
		<pubDate>Fri, 29 May 2015 19:53:38 +0000</pubDate>
				<category><![CDATA[HTML5]]></category>
		<category><![CDATA[chart]]></category>
		<category><![CDATA[HTML5 Chart]]></category>
		<category><![CDATA[JQuery]]></category>
		<category><![CDATA[Polar Area Chart]]></category>
		<guid isPermaLink="false">https://sibeeshpassion.com/?p=1111</guid>

					<description><![CDATA[Introduction I hope you have read my first two articles in this series that explains the loading of a Bar Chart, Pie Chart and Doughnut Chart. Please see the following links. Client-Side Chart Widget in HTML 5: Part 1 (Bar Chart) Client-Side Chart Widget in HTML 5: Part 2 (Pie Chart) Client-Side Chart Widget in HTML 5: Part 3 (Line Chart) Client-Side Chart Widget in HTML5: Part 4 (Doughnut Chart) Now we will explain a client-side Doughnut Chart widget in HTML5. Background Please download the necessary files here http://www.chartjs.org/. Using the code A simple HTML &#60;!DOCTYPE html&#62; &#60;html xmlns=&#8220;http://www.w3.org/1999/xhtml&#8221;&#62;    &#60;head&#62;        [&#8230;]]]></description>
										<content:encoded><![CDATA[<p><strong>Introduction<br />
</strong><br />
I hope you have read my first two articles in this series that explains the loading of a Bar Chart, Pie Chart and Doughnut Chart. Please see the following links.</p>
<ul>
<li><a href="http://www.c-sharpcorner.com/UploadFile/65794e/client-side-chart-widget-in-html-5-part-1-bar-chart/">Client-Side Chart Widget in HTML 5: Part 1 (Bar Chart)</a></li>
<li><a href="http://www.c-sharpcorner.com/UploadFile/65794e/client-side-chart-widget-in-html-5-part-2-pie-chart/">Client-Side Chart Widget in HTML 5: Part 2 (Pie Chart)</a></li>
<li><a href="http://www.c-sharpcorner.com/UploadFile/65794e/client-side-chart-widget-in-html5-part-3-line-chart/">Client-Side Chart Widget in HTML 5: Part 3 (Line Chart)</a></li>
<li><a href="http://www.c-sharpcorner.com/UploadFile/65794e/client-side-chart-widget-in-html5-part-4-doughnut-chart/">Client-Side Chart Widget in HTML5: Part 4 (Doughnut Chart)</a></li>
</ul>
<p>Now we will explain a client-side Doughnut Chart widget in HTML5.</p>
<p><strong>Background<br />
</strong><br />
Please download the necessary files here <a href="http://www.chartjs.org/" rel="nofollow">http://www.chartjs.org/</a>.</p>
<p><strong>Using the code<br />
</strong><br />
<strong>A simple HTML<br />
</strong></p>
<div class="dp-highlighter">
<ol class="dp-xml">
<li class="alt">&lt;!DOCTYPE html<span class="tag">&gt;</span></li>
<li><span class="tag">&lt;</span><span class="tag-name">html</span> <span class="attribute">xmlns</span>=<span class="attribute-value">&#8220;http://www.w3.org/1999/xhtml&#8221;</span><span class="tag">&gt;</span></li>
<li class="alt"><span class="tag">   &lt;</span><span class="tag-name">head</span><span class="tag">&gt;</span></li>
<li>       <span class="tag">&lt;</span><span class="tag-name">title</span><span class="tag">&gt;</span> Polar Area Chart Using Chart.js<span class="tag">&lt;/</span><span class="tag-name">title</span><span class="tag">&gt;</span></li>
<li class="alt"><span class="tag">   &lt;/</span><span class="tag-name">head</span><span class="tag">&gt;</span></li>
<li><span class="tag">   &lt;</span><span class="tag-name">body</span><span class="tag">&gt;</span><span class="tag">&lt;/</span><span class="tag-name">body</span><span class="tag">&gt;</span></li>
<li class="alt"><span class="tag">&lt;/</span><span class="tag-name">html</span><span class="tag">&gt;</span></li>
</ol>
</div>
<p><strong>Included JavaScript file</strong></p>
<div class="dp-highlighter">
<ol class="dp-xml">
<li class="alt"><span class="tag">&lt;</span><span class="tag-name">script</span> <span class="attribute">src</span>=<span class="attribute-value">&#8220;Chart.js&#8221;</span><span class="tag">&gt;</span><span class="tag">&lt;/</span><span class="tag-name">script</span><span class="tag">&gt;</span></li>
</ol>
</div>
<p><strong>Call the Chart Function</strong></p>
<div class="dp-highlighter">
<ol class="dp-xml">
<li class="alt"><span class="attribute">window.onload</span> = <span class="attribute-value">function</span> () {</li>
<li>            var <span class="attribute">canvasObject</span> = <span class="attribute-value">document</span>.getElementById(&#8220;myChart&#8221;).getContext(&#8220;2d&#8221;);</li>
<li class="alt">            <span class="attribute">window.myPolarArea</span> = <span class="attribute-value">new</span> Chart(canvasObject).PolarArea(polarChartData, {</li>
<li>                responsive: true</li>
<li class="alt">            });</li>
<li>        }</li>
</ol>
</div>
<p>Here we are loading the chart in the myChart.</p>
<p>As you can see in the preceding code, polarChartData is the data we will load into the chart.</p>
<div class="dp-highlighter">
<ol class="dp-xml">
<li class="alt">var <span class="attribute">polarChartData</span> = [</li>
<li>    {</li>
<li class="alt">        value: 200,</li>
<li>        color: &#8220;#F7464A&#8221;,</li>
<li class="alt">        highlight: &#8220;#FF5A5E&#8221;,</li>
<li>        label: &#8220;Monday&#8221;</li>
<li class="alt">    },</li>
<li>    {</li>
<li class="alt">        value: 50,</li>
<li>        color: &#8220;#46BFBD&#8221;,</li>
<li class="alt">        highlight: &#8220;#5AD3D1&#8221;,</li>
<li>        label: &#8220;Tuesday&#8221;</li>
<li class="alt">    },</li>
<li>    {</li>
<li class="alt">        value: 150,</li>
<li>        color: &#8220;#FDB45C&#8221;,</li>
<li class="alt">        highlight: &#8220;#FFC870&#8221;,</li>
<li>        label: &#8220;Wednesday&#8221;</li>
<li class="alt">    },</li>
<li>    {</li>
<li class="alt">        value: 20,</li>
<li>        color: &#8220;#949FB1&#8221;,</li>
<li class="alt">        highlight: &#8220;#A8B3C5&#8221;,</li>
<li>        label: &#8220;Saturday&#8221;</li>
<li class="alt">    },</li>
<li>    {</li>
<li class="alt">        value: 400,</li>
<li>        color: &#8220;#4D5360&#8221;,</li>
<li class="alt">        highlight: &#8220;#616774&#8221;,</li>
<li>        label: &#8220;Sunday&#8221;</li>
<li class="alt">    }</li>
<li></li>
<li class="alt">                 ];</li>
</ol>
</div>
<p><strong>Properties</strong></p>
<ul>
<li>value</li>
<li>color</li>
<li>highlight</li>
<li>label</li>
</ul>
<p>Here you can change the properties as you want.</p>
<p><strong>Complete HTML<br />
</strong></p>
<div class="dp-highlighter">
<ol class="dp-xml">
<li class="alt">&lt;!DOCTYPE html<span class="tag">&gt;</span></li>
<li><span class="tag">&lt;</span><span class="tag-name">html</span> <span class="attribute">xmlns</span>=<span class="attribute-value">&#8220;http://www.w3.org/1999/xhtml&#8221;</span><span class="tag">&gt;</span></li>
<li class="alt"><span class="tag">&lt;</span><span class="tag-name">head</span><span class="tag">&gt;</span></li>
<li>    <span class="tag">&lt;</span><span class="tag-name">title</span><span class="tag">&gt;</span>Doughnut Chart Using Chart.js<span class="tag">&lt;/</span><span class="tag-name">title</span><span class="tag">&gt;</span></li>
<li class="alt">    <span class="tag">&lt;</span><span class="tag-name">script</span> <span class="attribute">src</span>=<span class="attribute-value">&#8220;Chart.js&#8221;</span><span class="tag">&gt;</span><span class="tag">&lt;/</span><span class="tag-name">script</span><span class="tag">&gt;</span></li>
<li>    <span class="tag">&lt;</span><span class="tag-name">script</span><span class="tag">&gt;</span></li>
<li class="alt">        var <span class="attribute">polarChartData</span> = [</li>
<li>                {</li>
<li class="alt">                    value: 200,</li>
<li>                    color: &#8220;#F7464A&#8221;,</li>
<li class="alt">                    highlight: &#8220;#FF5A5E&#8221;,</li>
<li>                    label: &#8220;Monday&#8221;</li>
<li class="alt">                },</li>
<li>                {</li>
<li class="alt">                    value: 50,</li>
<li>                    color: &#8220;#46BFBD&#8221;,</li>
<li class="alt">                    highlight: &#8220;#5AD3D1&#8221;,</li>
<li>                    label: &#8220;Tuesday&#8221;</li>
<li class="alt">                },</li>
<li>                {</li>
<li class="alt">                    value: 150,</li>
<li>                    color: &#8220;#FDB45C&#8221;,</li>
<li class="alt">                    highlight: &#8220;#FFC870&#8221;,</li>
<li>                    label: &#8220;Wednesday&#8221;</li>
<li class="alt">                },</li>
<li>                {</li>
<li class="alt">                    value: 20,</li>
<li>                    color: &#8220;#949FB1&#8221;,</li>
<li class="alt">                    highlight: &#8220;#A8B3C5&#8221;,</li>
<li>                    label: &#8220;Saturday&#8221;</li>
<li class="alt">                },</li>
<li>                {</li>
<li class="alt">                    value: 400,</li>
<li>                    color: &#8220;#4D5360&#8221;,</li>
<li class="alt">                    highlight: &#8220;#616774&#8221;,</li>
<li>                    label: &#8220;Sunday&#8221;</li>
<li class="alt">                }</li>
<li></li>
<li class="alt">        ];</li>
<li></li>
<li class="alt">        <span class="attribute">window.onload</span> = <span class="attribute-value">function</span> () {</li>
<li>            var <span class="attribute">canvasObject</span> = <span class="attribute-value">document</span>.getElementById(&#8220;myChart&#8221;).getContext(&#8220;2d&#8221;);</li>
<li class="alt">            <span class="attribute">window.myPolarArea</span> = <span class="attribute-value">new</span> Chart(canvasObject).PolarArea(polarChartData, {</li>
<li>                responsive: true</li>
<li class="alt">            });</li>
<li>        }</li>
<li class="alt"></li>
<li>    <span class="tag">&lt;/</span><span class="tag-name">script</span><span class="tag">&gt;</span></li>
<li class="alt"><span class="tag">&lt;/</span><span class="tag-name">head</span><span class="tag">&gt;</span></li>
<li><span class="tag">&lt;</span><span class="tag-name">body</span><span class="tag">&gt;</span></li>
<li class="alt">    <span class="tag">&lt;</span><span class="tag-name">div</span><span class="tag">&gt;</span></li>
<li>        Polar Area Chart @ <span class="tag">&lt;</span><span class="tag-name">a</span> <span class="attribute">href</span>=<span class="attribute-value">&#8220;www.sibeeshpassion.com&#8221;</span><span class="tag">&gt;</span>Sibeesh Passion<span class="tag">&lt;/</span><span class="tag-name">a</span><span class="tag">&gt;</span></li>
<li class="alt">        <span class="tag">&lt;</span><span class="tag-name">canvas</span> <span class="attribute">id</span>=<span class="attribute-value">&#8220;myChart&#8221;</span><span class="tag">&gt;</span><span class="tag">&lt;/</span><span class="tag-name">canvas</span><span class="tag">&gt;</span></li>
<li>    <span class="tag">&lt;/</span><span class="tag-name">div</span><span class="tag">&gt;</span></li>
<li class="alt"><span class="tag">&lt;/</span><span class="tag-name">body</span><span class="tag">&gt;</span></li>
<li><span class="tag">&lt;/</span><span class="tag-name">html</span><span class="tag">&gt;</span></li>
</ol>
</div>
<p><strong>Conclusion<br />
</strong><br />
I hope you can now create your own chart.</p>
<p><strong>Output</p>
<p><img decoding="async" src="http://www.c-sharpcorner.com/UploadFile/65794e/client-side-chart-widget-in-html5-part-5-polar-area-chart/Images/Output.jpg" alt="Output" /></strong></p>
]]></content:encoded>
					
					<wfw:commentRss>https://sibeeshpassion.com/client-side-chart-widget-in-html5-part-5-polar-area-chart/feed/</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
			</item>
		<item>
		<title>Client-Side Chart Widget in HTML 5: Part 2 (Pie Chart)</title>
		<link>https://sibeeshpassion.com/client-side-chart-widget-in-html-5-part-2-pie-chart/</link>
					<comments>https://sibeeshpassion.com/client-side-chart-widget-in-html-5-part-2-pie-chart/#disqus_thread</comments>
		
		<dc:creator><![CDATA[SibeeshVenu]]></dc:creator>
		<pubDate>Fri, 29 May 2015 19:48:02 +0000</pubDate>
				<category><![CDATA[HTML5]]></category>
		<category><![CDATA[chart]]></category>
		<category><![CDATA[HTML5 Chart]]></category>
		<category><![CDATA[JQuery]]></category>
		<category><![CDATA[Pie Chart]]></category>
		<guid isPermaLink="false">https://sibeeshpassion.com/?p=1012</guid>

					<description><![CDATA[Introduction Hi all, I hope you are fine. I hope you have read my first part of this series that explains about loading the Bar Chart. Today we will explain a client-side Pie Chart widget in HTML5. Background As you need, you need to download the files. Please download the necessary files from here. Using the code A simple HTML &#60;!DOCTYPE html&#62; &#60;html xmlns=&#8220;http://www.w3.org/1999/xhtml&#8221;&#62;    &#60;head&#62;        &#60;title&#62;Pie Chart Using Chart.js&#60;/title&#62;    &#60;/head&#62;    &#60;body&#62;&#60;/body&#62; &#60;/html&#62; Included JavaScript file &#60;script src=&#8220;Chart.js&#8221;&#62;&#60;/script&#62; Call the Chart Function window.onload = function () {         var canvasObject = document.getElementById(&#8220;myChart&#8221;).getContext(&#8220;2d&#8221;);         window.myPie = new Chart(canvasObject).Pie(pieChartData);     } Here we are loading the chart in myChart. As you can see in the preceding code, pieChartData is the data we will [&#8230;]]]></description>
										<content:encoded><![CDATA[<p><strong>Introduction</strong></p>
<p>Hi all, I hope you are fine. I hope you have read my <a href="http://www.c-sharpcorner.com/uploadfile/65794e/client-side-chart-widget-in-html-5-part-1-bar-chart/">first part</a> of this series that explains about loading the Bar Chart. Today we will explain a client-side Pie Chart widget in HTML5.</p>
<p><strong>Background<br />
</strong><br />
As you need, you need to download the files. Please download the necessary files from <a href="http://www.chartjs.org/" rel="nofollow">here</a>.</p>
<p><strong>Using the code<br />
</strong><br />
<strong>A simple HTML</strong></p>
<div class="dp-highlighter">
<div class="bar"></div>
<ol class="dp-c">
<li class="alt">&lt;!DOCTYPE html&gt;</li>
<li>&lt;html xmlns=<span class="string">&#8220;http://www.w3.org/1999/xhtml&#8221;</span>&gt;</li>
<li class="alt">   &lt;head&gt;</li>
<li>       &lt;title&gt;Pie Chart Using Chart.js&lt;/title&gt;</li>
<li class="alt">   &lt;/head&gt;</li>
<li>   &lt;body&gt;&lt;/body&gt;</li>
<li class="alt">&lt;/html&gt;</li>
</ol>
</div>
<p><strong>Included JavaScript file</strong></p>
<div class="dp-highlighter">
<div class="bar"></div>
<ol class="dp-c">
<li class="alt">&lt;script src=<span class="string">&#8220;Chart.js&#8221;</span>&gt;&lt;/script&gt;</li>
</ol>
</div>
<p><strong>Call the Chart Function</strong></p>
<div class="dp-highlighter">
<div class="bar"></div>
<ol class="dp-c">
<li class="alt">window.onload = <span class="keyword">function</span> () {</li>
<li>        <span class="keyword">var</span> canvasObject = document.getElementById(<span class="string">&#8220;myChart&#8221;</span>).getContext(<span class="string">&#8220;2d&#8221;</span>);</li>
<li class="alt">        window.myPie = <span class="keyword">new</span> Chart(canvasObject).Pie(pieChartData);</li>
<li>    }</li>
</ol>
</div>
<p>Here we are loading the chart in myChart.</p>
<p>As you can see in the preceding code, pieChartData is the data we will load into the chart.</p>
<div class="dp-highlighter">
<div class="bar"></div>
<ol class="dp-c">
<li class="alt"><span class="keyword">var</span> pieChartData = [</li>
<li>                {</li>
<li class="alt">                    value: 600,</li>
<li>                    color: <span class="string">&#8220;#F7464A&#8221;</span>,</li>
<li class="alt">                    highlight: <span class="string">&#8220;#FF5A5E&#8221;</span>,</li>
<li>                    label: <span class="string">&#8220;Monday&#8221;</span></li>
<li class="alt">                },</li>
<li>                {</li>
<li class="alt">                    value: 150,</li>
<li>                    color: <span class="string">&#8220;#46BFBD&#8221;</span>,</li>
<li class="alt">                    highlight: <span class="string">&#8220;#5AD3D1&#8221;</span>,</li>
<li>                    label: <span class="string">&#8220;Tuesday&#8221;</span></li>
<li class="alt">                },</li>
<li>                {</li>
<li class="alt">                    value: 100,</li>
<li>                    color: <span class="string">&#8220;#FDB45C&#8221;</span>,</li>
<li class="alt">                    highlight: <span class="string">&#8220;#FFC870&#8221;</span>,</li>
<li>                    label: <span class="string">&#8220;Wednesday&#8221;</span></li>
<li class="alt">                },</li>
<li>                {</li>
<li class="alt">                    value: 400,</li>
<li>                    color: <span class="string">&#8220;#949FB1&#8221;</span>,</li>
<li class="alt">                    highlight: <span class="string">&#8220;#A8B3C5&#8221;</span>,</li>
<li>                    label: <span class="string">&#8220;Thursday&#8221;</span></li>
<li class="alt">                },</li>
<li>                {</li>
<li class="alt">                    value: 120,</li>
<li>                    color: <span class="string">&#8220;#4D5360&#8221;</span>,</li>
<li class="alt">                    highlight: <span class="string">&#8220;#616774&#8221;</span>,</li>
<li>                    label: <span class="string">&#8220;Friday&#8221;</span></li>
<li class="alt">                }</li>
<li></li>
<li class="alt">    ];</li>
</ol>
</div>
<p><strong>Properties</strong></p>
<ul>
<li>value</li>
<li>color</li>
<li>highlight</li>
<li>label</li>
</ul>
<p>Here you can change the properties as you want.</p>
<p><strong>Complete HTML<br />
</strong></p>
<div class="dp-highlighter">
<div class="bar"></div>
<ol class="dp-c">
<li class="alt">&lt;!DOCTYPE html&gt;</li>
<li>&lt;html xmlns=<span class="string">&#8220;http://www.w3.org/1999/xhtml&#8221;</span>&gt;</li>
<li class="alt">&lt;head&gt;</li>
<li>    &lt;title&gt;Pie Chart Using Chart.js&lt;/title&gt;</li>
<li class="alt">    &lt;script src=<span class="string">&#8220;Chart.js&#8221;</span>&gt;&lt;/script&gt;</li>
<li>    &lt;script&gt;</li>
<li class="alt">    <span class="keyword">var</span> pieChartData = [</li>
<li>                {</li>
<li class="alt">                    value: 600,</li>
<li>                    color: <span class="string">&#8220;#F7464A&#8221;</span>,</li>
<li class="alt">                    highlight: <span class="string">&#8220;#FF5A5E&#8221;</span>,</li>
<li>                    label: <span class="string">&#8220;Monday&#8221;</span></li>
<li class="alt">                },</li>
<li>                {</li>
<li class="alt">                    value: 150,</li>
<li>                    color: <span class="string">&#8220;#46BFBD&#8221;</span>,</li>
<li class="alt">                    highlight: <span class="string">&#8220;#5AD3D1&#8221;</span>,</li>
<li>                    label: <span class="string">&#8220;Tuesday&#8221;</span></li>
<li class="alt">                },</li>
<li>                {</li>
<li class="alt">                    value: 100,</li>
<li>                    color: <span class="string">&#8220;#FDB45C&#8221;</span>,</li>
<li class="alt">                    highlight: <span class="string">&#8220;#FFC870&#8221;</span>,</li>
<li>                    label: <span class="string">&#8220;Wednesday&#8221;</span></li>
<li class="alt">                },</li>
<li>                {</li>
<li class="alt">                    value: 400,</li>
<li>                    color: <span class="string">&#8220;#949FB1&#8221;</span>,</li>
<li class="alt">                    highlight: <span class="string">&#8220;#A8B3C5&#8221;</span>,</li>
<li>                    label: <span class="string">&#8220;Thursday&#8221;</span></li>
<li class="alt">                },</li>
<li>                {</li>
<li class="alt">                    value: 120,</li>
<li>                    color: <span class="string">&#8220;#4D5360&#8221;</span>,</li>
<li class="alt">                    highlight: <span class="string">&#8220;#616774&#8221;</span>,</li>
<li>                    label: <span class="string">&#8220;Friday&#8221;</span></li>
<li class="alt">                }</li>
<li></li>
<li class="alt">    ];</li>
<li>    window.onload = <span class="keyword">function</span> () {</li>
<li class="alt">        <span class="keyword">var</span> canvasObject = document.getElementById(<span class="string">&#8220;myChart&#8221;</span>).getContext(<span class="string">&#8220;2d&#8221;</span>);</li>
<li>        window.myPie = <span class="keyword">new</span> Chart(canvasObject).Pie(pieChartData);</li>
<li class="alt"></li>
<li>    }</li>
<li class="alt"></li>
<li>    &lt;/script&gt;</li>
<li class="alt">&lt;/head&gt;</li>
<li>&lt;body&gt;</li>
<li class="alt">    &lt;div&gt;</li>
<li>        &lt;canvas id=<span class="string">&#8220;myChart&#8221;</span>&gt;&lt;/canvas&gt;</li>
<li class="alt">    &lt;/div&gt;</li>
<li>&lt;/body&gt;</li>
<li class="alt">&lt;/html&gt;</li>
</ol>
</div>
<p><strong>Conclusion<br />
</strong><br />
I hope you can now create your own chart.</p>
<p><strong>Output</strong></p>
<p><img decoding="async" src="http://www.c-sharpcorner.com/UploadFile/65794e/client-side-chart-widget-in-html-5-part-2-pie-chart/Images/Output.jpg" alt="" /></p>
<p>&nbsp;</p>
]]></content:encoded>
					
					<wfw:commentRss>https://sibeeshpassion.com/client-side-chart-widget-in-html-5-part-2-pie-chart/feed/</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
			</item>
		<item>
		<title>Create a Combo Chart and Make Your Chart Draggable</title>
		<link>https://sibeeshpassion.com/create-a-combo-chart-and-make-your-chart-draggable/</link>
					<comments>https://sibeeshpassion.com/create-a-combo-chart-and-make-your-chart-draggable/#disqus_thread</comments>
		
		<dc:creator><![CDATA[SibeeshVenu]]></dc:creator>
		<pubDate>Wed, 29 Apr 2015 20:34:03 +0000</pubDate>
				<category><![CDATA[HighChart]]></category>
		<category><![CDATA[HTML5]]></category>
		<category><![CDATA[JQuery]]></category>
		<category><![CDATA[chart]]></category>
		<category><![CDATA[Combo Chart]]></category>
		<category><![CDATA[Draggable Chart]]></category>
		<category><![CDATA[HTML5 Chart]]></category>
		<guid isPermaLink="false">https://sibeeshpassion.com/?p=1821</guid>

					<description><![CDATA[Introduction Hi all, this article explains how to create a Combo chart. As you all know, the word combo is short for combination, in this case it is a combination of chart types. Which means we can have multiple chart types in one chart. Background For the past few months I have been working in a dashboard application, so I encountered a situation to work with a Combo chart in my application. As I began working with the Combo chart, when I finished the work I got a new requirement that a Pie chart must be draggable in the chart [&#8230;]]]></description>
										<content:encoded><![CDATA[<p><strong>Introduction</strong><br />
Hi all, this article explains how to create a Combo chart. As you all know, the word combo is short for combination, in this case it is a combination of chart types. Which means we can have multiple chart types in one chart.</p>
<p><strong>Background</strong></p>
<p>For the past few months I have been working in a dashboard application, so I encountered a situation to work with a Combo chart in my application. As I began working with the Combo chart, when I finished the work I got a new requirement that a Pie chart must be draggable in the chart area. So I thought of working on that and share it with you all.</p>
<p><strong>What we need first</strong></p>
<p>Include the necessary JavaScript files and UI elements as follows.</p>
<div>
<div class="dp-highlighter">
<div class="bar"></div>
<ol class="dp-c">
<li class="alt">&lt;script src=<span class="string">&#8220;http://code.highcharts.com/highcharts.js&#8221;</span>&gt;&lt;/script&gt;</li>
<li>&lt;script src=<span class="string">&#8220;http://code.highcharts.com/modules/exporting.js&#8221;</span>&gt;&lt;/script&gt;</li>
<li class="alt">&lt;div id=<span class="string">&#8220;container&#8221;</span> style=<span class="string">&#8220;min-width: 310px; height: 400px; margin: 0 auto&#8221;</span>&gt;&lt;/div&gt;</li>
<li>&lt;div id=<span class="string">&#8220;container2&#8221;</span> style=<span class="string">&#8220;width: 150px; height: 150px; margin: 0 auto; position:absolute; top: 120px; left: 150px;&#8221;</span>&gt;&lt;/div&gt;</li>
</ol>
</div>
</div>
<p><strong>Combo chart configuration</strong></p>
<p>Our next step is to configure the Combo chart. You can determine the configuration here.</p>
<div>
<div class="dp-highlighter">
<div class="bar"></div>
<ol class="dp-c">
<li class="alt">$(function()</li>
<li>{</li>
<li class="alt">    $(<span class="string">&#8216;#container&#8217;</span>).highcharts({</li>
<li>        title: {</li>
<li class="alt">            text: <span class="string">&#8216;Worked hours in a week&#8217;</span></li>
<li>        },</li>
<li class="alt">        xAxis: {</li>
<li>            categories: [<span class="string">&#8216;Apples&#8217;</span>, <span class="string">&#8216;Oranges&#8217;</span>, <span class="string">&#8216;Pears&#8217;</span>, <span class="string">&#8216;Bananas&#8217;</span>, <span class="string">&#8216;Plums&#8217;</span>]</li>
<li class="alt">        },</li>
<li>        series: [{</li>
<li class="alt">            type: <span class="string">&#8216;column&#8217;</span>,</li>
<li>            name: <span class="string">&#8216;Monday&#8217;</span>,</li>
<li class="alt">            data: [3, 2, 1, 3, 4]</li>
<li>        }, {</li>
<li class="alt">            type: <span class="string">&#8216;column&#8217;</span>,</li>
<li>            name: <span class="string">&#8216;Tuesday&#8217;</span>,</li>
<li class="alt">            data: [2, 3, 5, 7, 6]</li>
<li>        }, {</li>
<li class="alt">            type: <span class="string">&#8216;column&#8217;</span>,</li>
<li>            name: <span class="string">&#8216;Wednesday&#8217;</span>,</li>
<li class="alt">            data: [4, 3, 3, 9, 0]</li>
<li>        }, {</li>
<li class="alt">            type: <span class="string">&#8216;column&#8217;</span>,</li>
<li>            name: <span class="string">&#8216;Thursday&#8217;</span>,</li>
<li class="alt">            data: [4, 3, 3, 9, 0]</li>
<li>        }, {</li>
<li class="alt">            type: <span class="string">&#8216;column&#8217;</span>,</li>
<li>            name: <span class="string">&#8216;Friday&#8217;</span>,</li>
<li class="alt">            data: [4, 3, 3, 9, 0]</li>
<li>        }, {</li>
<li class="alt">            type: <span class="string">&#8216;spline&#8217;</span>,</li>
<li>            name: <span class="string">&#8216;Thursday&#8217;</span>,</li>
<li class="alt">            data: [3, 2.67, 3, 6.33, 3.33],</li>
<li>            marker: {</li>
<li class="alt">                lineWidth: 2,</li>
<li>                lineColor: Highcharts.getOptions().colors[3],</li>
<li class="alt">                fillColor: <span class="string">&#8216;white&#8217;</span></li>
<li>            }</li>
<li class="alt">        }]</li>
<li>    });</li>
<li class="alt">    $(<span class="string">&#8216;#container2&#8217;</span>).highcharts({</li>
<li>        chart: {</li>
<li class="alt">            backgroundColor: <span class="string">&#8216;rgba(0,0,0,0)&#8217;</span></li>
<li>        },</li>
<li class="alt">        title: {</li>
<li>            text: <span class="keyword">null</span></li>
<li class="alt">        },</li>
<li>        exporting: {</li>
<li class="alt">            enabled: <span class="keyword">false</span></li>
<li>        },</li>
<li class="alt">        credits: {</li>
<li>            enabled: <span class="keyword">false</span></li>
<li class="alt">        },</li>
<li>        series: [{</li>
<li class="alt">            type: <span class="string">&#8216;pie&#8217;</span>,</li>
<li>            name: <span class="string">&#8216;Total&#8217;</span>,</li>
<li class="alt">            data: [{</li>
<li>                name: <span class="string">&#8216;Monday&#8217;</span>,</li>
<li class="alt">                y: 13,</li>
<li>                color: Highcharts.getOptions().colors[0]</li>
<li class="alt">            }, {</li>
<li>                name: <span class="string">&#8216;Tuesday&#8217;</span>,</li>
<li class="alt">                y: 23,</li>
<li>                color: Highcharts.getOptions().colors[1]</li>
<li class="alt">            }, {</li>
<li>                name: <span class="string">&#8216;Wednesday&#8217;</span>,</li>
<li class="alt">                y: 19,</li>
<li>                color: Highcharts.getOptions().colors[2]</li>
<li class="alt">            }, {</li>
<li>                name: <span class="string">&#8216;Thursday&#8217;</span>,</li>
<li class="alt">                y: 19,</li>
<li>                color: Highcharts.getOptions().colors[2]</li>
<li class="alt">            }, {</li>
<li>                name: <span class="string">&#8216;Friday&#8217;</span>,</li>
<li class="alt">                y: 19,</li>
<li>                color: Highcharts.getOptions().colors[2]</li>
<li class="alt">            }],</li>
<li>            size: 90,</li>
<li class="alt">            showInLegend: <span class="keyword">false</span>,</li>
<li>            dataLabels: {</li>
<li class="alt">                enabled: <span class="keyword">false</span></li>
<li>            }</li>
<li class="alt">        }]</li>
<li>    });</li>
<li class="alt">    $(<span class="string">&#8220;#container2&#8221;</span>).draggable();</li>
<li>});</li>
</ol>
</div>
</div>
<p>Please note that I have given the Pie chart as a separate chart so that we can make it draggable as follows.</p>
<div class="dp-highlighter">
<div class="bar"></div>
<ol class="dp-c">
<li class="alt">$(<span class="string">&#8220;#container2&#8221;</span>).draggable();</li>
</ol>
</div>
<p>You can determine the demo here: <a href="http://jsfiddle.net/sibeeshvenu/oc1mn8ru/4/">http://jsfiddle.net/sibeeshvenu/oc1mn8ru/4/</a></p>
<p><strong>Output</strong></p>
<p>Now if you run this configuration you will get output as follows.</p>
<p><img decoding="async" src="http://www.c-sharpcorner.com/UploadFile/65794e/combo-chart-and-make-chart-as-draggable/Images/comboart1.png" alt="" width="600" height="333" /></p>
<p>Now the interesting fact is, you can drag the pie to where ever you want it.</p>
<p><img decoding="async" src="http://www.c-sharpcorner.com/UploadFile/65794e/combo-chart-and-make-chart-as-draggable/Images/comboart2.png" alt="" width="600" height="325" /></p>
<p><strong>Conclusion</strong></p>
<p>I hope you liked this article. Now please share your thoughts and suggestions. It matters a lot.</p>
<p>Kindest Regards,</p>
<p>Sibeesh Venu<br />
<a href="http://www.c-sharpcorner.com/UploadFile/65794e/combo-chart-and-make-chart-as-draggable/www.sibeeshpassion.com">Sibeesh Passion</a></p>
]]></content:encoded>
					
					<wfw:commentRss>https://sibeeshpassion.com/create-a-combo-chart-and-make-your-chart-draggable/feed/</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
			</item>
		<item>
		<title>Basic Difference Between Local Storage and Session Storage in HTML 5</title>
		<link>https://sibeeshpassion.com/basic-difference-between-local-storage-and-session-storage-in-html-5/</link>
					<comments>https://sibeeshpassion.com/basic-difference-between-local-storage-and-session-storage-in-html-5/#disqus_thread</comments>
		
		<dc:creator><![CDATA[SibeeshVenu]]></dc:creator>
		<pubDate>Sun, 29 Mar 2015 20:14:03 +0000</pubDate>
				<category><![CDATA[HTML5]]></category>
		<category><![CDATA[Difference between local storage and session storage]]></category>
		<category><![CDATA[Local Storage]]></category>
		<category><![CDATA[Session Storage]]></category>
		<category><![CDATA[Storage in HTML5]]></category>
		<guid isPermaLink="false">https://sibeeshpassion.com/?p=1501</guid>

					<description><![CDATA[[toc] Introduction This article explains what is the basic difference between HTML 5 local storage and session storage. Basically, both session storage and local storage are part of storage mechanism which is introduced with HTML5. By using these two, we can store information on client side itself. I hope you will like it. If you are new to the term local storage, I recommend you to read my article here: Local Storage Basic scenario where you can use If you need to carry a value throughout your application or throughout your pages, you can use local storage. For example, we [&#8230;]]]></description>
										<content:encoded><![CDATA[<p>[toc]</p>
<h3>Introduction</h3>
<p>
This article explains what is the basic difference between HTML 5 local storage and session storage. Basically, both session storage and local storage are part of storage mechanism which is introduced with HTML5. By using these two, we can store information on client side itself.  I hope you will like it.</p>
<p>If you are new to the term local storage, I recommend you to read my article here: <a href="http://sibeeshpassion.com/working-with-client-side-local-storage/" target="_blank">Local Storage</a></p>
<p><h3>Basic scenario where you can use</h3>
<p>
If you need to carry a value throughout your application or throughout your pages, you can use local storage. For example, we can store a logged-in username in local storage that we may need to access all the pages. I strongly recommend to not store any secured data (for example a “password”) in local storage.</p>
<p>In some scenario, we may need to set a key element depending on the pages we have in the application. For example, if we need to store the page name (any key element that may be different).<br />
So let’s start</p>
<p><h3>Using the code</h3>
<p>
Here in my application, I have added two HTML5 pages.</p>
<p><em>HtmlPage1.html</em><br />
<em>HtmlPage2.html</em></p>
<p>In <em>HtmlPage1.html</em> I have set local storage and session storage, now I am trying to access that in <em>HtmlPage2.html</em>. Please see the following source.</p>
<p><em>HtmlPage1.html</em><br />
[html]<br />
&lt;!DOCTYPE html&gt;<br />
&lt;html<br />
    xmlns=“http://www.w3.org/1999/xhtml”&gt;<br />
    &lt;head&gt;<br />
        &lt;title&gt;Difference between local storage and session storage&lt;/title&gt;<br />
        &lt;script&gt;<br />
            localStorage.setItem(“myKey”, 1);<br />
            sessionStorage.setItem(“myKey”, 1);<br />
            var myVal = localStorage.getItem(“myKey”);<br />
            alert(“My local storage value is : ” + myVal);<br />
            alert(“My session storage value is : ” + sessionStorage.getItem(“myKey”));<br />
        &lt;/script&gt;<br />
    &lt;/head&gt;<br />
    &lt;body&gt;<br />
    &lt;/body&gt;<br />
&lt;/html&gt;<br />
[/html]</p>
<p><em>HtmlPage2.html</em><br />
[html]<br />
&lt;!DOCTYPE html&gt;<br />
&lt;html<br />
    xmlns=“http://www.w3.org/1999/xhtml”&gt;<br />
    &lt;head&gt;<br />
        &lt;title&gt;Difference between local storage and session storage&lt;/title&gt;<br />
        &lt;script&gt;<br />
            var myVal = localStorage.getItem(“myKey”);<br />
            alert(“My local storage value is : ” + myVal);<br />
            alert(“My session storage value is : ” + sessionStorage.getItem(“myKey”));<br />
        &lt;/script&gt;<br />
    &lt;/head&gt;<br />
    &lt;body&gt;<br />
    &lt;/body&gt;<br />
&lt;/html&gt;<br />
[/html]</p>
<p>When you run the first page, in the browser console you will see as in the following image.</p>
<p><a href="http://sibeeshpassion.com/wp-content/uploads/2015/03/local-storage.jpg"><img decoding="async" src="http://sibeeshpassion.com/wp-content/uploads/2015/03/local-storage.jpg" alt="local storage" width="624" height="135" class="alignnone size-full wp-image-8461" srcset="/wp-content/uploads/2015/03/local-storage.jpg 624w, /wp-content/uploads/2015/03/local-storage-300x65.jpg 300w, /wp-content/uploads/2015/03/local-storage-620x135.jpg 620w, /wp-content/uploads/2015/03/local-storage-400x87.jpg 400w" sizes="(max-width: 624px) 100vw, 624px" /></a></p>
<p>Figure: Local Storage</p>
<p><a href="http://sibeeshpassion.com/wp-content/uploads/2015/03/session-storage.jpg"><img decoding="async" src="http://sibeeshpassion.com/wp-content/uploads/2015/03/session-storage.jpg" alt="session storage" width="624" height="135" class="alignnone size-full wp-image-8462" srcset="/wp-content/uploads/2015/03/session-storage.jpg 624w, /wp-content/uploads/2015/03/session-storage-300x65.jpg 300w, /wp-content/uploads/2015/03/session-storage-620x135.jpg 620w, /wp-content/uploads/2015/03/session-storage-400x87.jpg 400w" sizes="(max-width: 624px) 100vw, 624px" /></a></p>
<p>Figure: Session Storage</p>
<p>Now it is time to run the second page. Once you run that please check in the console. You can see as follows.</p>
<p><a href="http://sibeeshpassion.com/wp-content/uploads/2015/03/htmlpage2-local-storage.jpg"><img decoding="async" src="http://sibeeshpassion.com/wp-content/uploads/2015/03/htmlpage2-local-storage.jpg" alt="htmlpage2 local storage" width="624" height="301" class="alignnone size-full wp-image-8471" srcset="/wp-content/uploads/2015/03/htmlpage2-local-storage.jpg 624w, /wp-content/uploads/2015/03/htmlpage2-local-storage-300x145.jpg 300w, /wp-content/uploads/2015/03/htmlpage2-local-storage-400x193.jpg 400w" sizes="(max-width: 624px) 100vw, 624px" /></a></p>
<p>Figure: Local storage</p>
<p><a href="http://sibeeshpassion.com/wp-content/uploads/2015/03/htmlpage2-session-storage.jpg"><img decoding="async" src="http://sibeeshpassion.com/wp-content/uploads/2015/03/htmlpage2-session-storage.jpg" alt="htmlpage2 session storage" width="624" height="307" class="alignnone size-full wp-image-8481" srcset="/wp-content/uploads/2015/03/htmlpage2-session-storage.jpg 624w, /wp-content/uploads/2015/03/htmlpage2-session-storage-300x148.jpg 300w, /wp-content/uploads/2015/03/htmlpage2-session-storage-400x197.jpg 400w" sizes="(max-width: 624px) 100vw, 624px" /></a></p>
<p>Figure: Session storage</p>
<p>Please note that session storage is null. You can see the session storage only if you set it on that running page.
</p>
<h3>Conclusion</h3>
<p>
Thanks a lot for reading. Did I miss anything that you may think which is needed? Could you find this post as useful? I hope you liked this article. Please share me your valuable suggestions and feedback.
</p>
<h3>Your turn. What do you think?</h3>
<p>
A blog isn’t a blog without comments, but do try to stay on topic. If you have a question unrelated to this post, you’re better off posting it on C# Corner, Code Project, Stack Overflow, Asp.Net Forum instead of commenting here. Tweet or email me a link to your question there and I’ll definitely try to help if I can.
</p>
<p>Kindest Regards<br />
Sibeesh Venu</p>
]]></content:encoded>
					
					<wfw:commentRss>https://sibeeshpassion.com/basic-difference-between-local-storage-and-session-storage-in-html-5/feed/</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
			</item>
		<item>
		<title>Creating Custom Color Palette Using JQuery, HTML5, CSS</title>
		<link>https://sibeeshpassion.com/creating-custom-color-palette-using-jquery-html5-css/</link>
					<comments>https://sibeeshpassion.com/creating-custom-color-palette-using-jquery-html5-css/#disqus_thread</comments>
		
		<dc:creator><![CDATA[SibeeshVenu]]></dc:creator>
		<pubDate>Sun, 29 Mar 2015 20:11:35 +0000</pubDate>
				<category><![CDATA[HTML5]]></category>
		<category><![CDATA[JQuery]]></category>
		<category><![CDATA[Colour Palette]]></category>
		<category><![CDATA[Colour Palette in JQuery]]></category>
		<category><![CDATA[Create Custom Colour Palette]]></category>
		<guid isPermaLink="false">https://sibeeshpassion.com/?p=1441</guid>

					<description><![CDATA[Today I came across a requirement to integrate a colour palette into my application. When I searched for that, unfortunately I could not find any solution . So I thought of creating a custom color palette tool. This article explains how to do this. I will use this tool in my high chart application. I hope you will like it. Please see the following image if you do not know what a colour palette is. Background I am working in a dashboard application, where you can find many charts, maps and grids and so on. If you work with a [&#8230;]]]></description>
										<content:encoded><![CDATA[<p>Today I came across a requirement to integrate a colour palette into my application. When I searched for that, unfortunately I could not find any solution . So I thought of creating a custom color palette tool. This article explains how to do this. I will use this tool in my high chart application. I hope you will like it. Please see the following image if you do not know what a colour palette is.</p>
<p><strong>Background</strong></p>
<p>I am working in a dashboard application, where you can find many charts, maps and grids and so on. If you work with a chart, you will definitely know the word series . Previously we were applying the color for every series separately, in other words the user must select the color for each series or it will take some default color. Your user may think this process is too much work. Here I am providing a custom color palette control.</p>
<p><strong>Download Source Code</strong></p>
<p><a href="http://sibeeshpassion.com/download/ColorPalette.rar" target="_blank">Custom Colour Palette</a></p>
<p><strong>Why</strong></p>
<p>Instead of applying colors separately, we can just select a palette so that the colors set in the selected palette will be applied automatically as in Excel.</p>
<p><strong>Using the code</strong></p>
<p>I am using <em>jquery-1.9.1.js</em> for the implementation in my application, you can get this file from the attached application. </p>
<p>Once you include the jQuery file, please create an HTML5 page as shown below.<br />
[html]<br />
&lt;!DOCTYPE html&gt;<br />
&lt;html xmlns=&quot;http://www.w3.org/1999/xhtml&quot;&gt;<br />
&lt;head&gt;<br />
    &lt;title&gt;&lt;/title&gt;<br />
&lt;/head&gt;<br />
&lt;body&gt;  </p>
<p>&lt;/body&gt;<br />
&lt;/html&gt;<br />
[/html]</p>
<p><strong>Include the jQuery reference as in the following</strong><br />
[js]<br />
&lt;script src=&quot;jquery-1.9.1.js&quot;&gt;&lt;/script&gt;<br />
[/js]</p>
<p>Now to replace our body tag as shown below<br />
[html]<br />
&lt;body&gt;<br />
    &lt;header style=&quot;text-align:center&quot;&gt; Custom Color Palette &#8211; sibeeshpassion&lt;/header&gt;  </p>
<p>    &lt;br /&gt;<br />
    &lt;br /&gt;<br />
    &lt;br /&gt;<br />
    &lt;br /&gt;<br />
    &lt;br /&gt;<br />
    &lt;br /&gt;<br />
    Change Series Color:<br />
    &lt;label id=&quot;changecolor&quot; title=&quot;Change Color&quot;&gt;&lt;u&gt;&lt;i&gt;Change Color&lt;/i&gt;&lt;/u&gt;&lt;/label&gt;<br />
    &lt;ul class=&quot;containerul&quot;&gt;<br />
        &lt;li&gt;<br />
            &lt;p class=&quot;boxcontainer&quot;&gt;<br />
                Color Palette I :<br />
                &lt;br /&gt;<br />
                &lt;span class=&quot;simplebox&quot; title=&quot;#F29F98&quot; style=&quot;background-color: #F29F98&quot;&gt;&lt;/span&gt;<br />
                &lt;span class=&quot;simplebox&quot; title=&quot;#F27C72&quot; style=&quot;background-color: #F27C72&quot;&gt;&lt;/span&gt;<br />
                &lt;span class=&quot;simplebox&quot; title=&quot;#F15C4E&quot; style=&quot;background-color: #F15C4E&quot;&gt;&lt;/span&gt;<br />
                &lt;span class=&quot;simplebox boxspecialone&quot; title=&quot;#F03B2A&quot; style=&quot;background-color: #F03B2A&quot;&gt;&lt;/span&gt;<br />
                &lt;span class=&quot;simplebox&quot; title=&quot;#F12815&quot; style=&quot;background-color: #F12815&quot;&gt;&lt;/span&gt;<br />
                &lt;span class=&quot;simplebox&quot; title=&quot;#FF1601&quot; style=&quot;background-color: #FF1601&quot;&gt;&lt;/span&gt;<br />
                &lt;input type=&quot;checkbox&quot; class=&quot;boxcheckbox&quot; /&gt;<br />
            &lt;/p&gt;<br />
        &lt;/li&gt;<br />
        &lt;li&gt;<br />
            &lt;p class=&quot;boxcontainer&quot;&gt;<br />
                Color Palette II :<br />
                &lt;br /&gt;<br />
                &lt;span class=&quot;simplebox&quot; title=&quot;#A3F0BE&quot; style=&quot;background-color: #A3F0BE&quot;&gt;&lt;/span&gt;<br />
                &lt;span class=&quot;simplebox&quot; title=&quot;#7FEBA5&quot; style=&quot;background-color: #7FEBA5&quot;&gt;&lt;/span&gt;<br />
                &lt;span class=&quot;simplebox&quot; title=&quot;#48EB81&quot; style=&quot;background-color: #48EB81&quot;&gt;&lt;/span&gt;<br />
                &lt;span class=&quot;simplebox boxspecialone&quot; title=&quot;#25EB6B&quot; style=&quot;background-color: #25EB6B&quot;&gt;&lt;/span&gt;<br />
                &lt;span class=&quot;simplebox&quot; title=&quot;#14E85E&quot; style=&quot;background-color: #14E85E&quot;&gt;&lt;/span&gt;<br />
                &lt;span class=&quot;simplebox&quot; title=&quot;#03E552&quot; style=&quot;background-color: #03E552&quot;&gt;&lt;/span&gt;<br />
                &lt;input type=&quot;checkbox&quot; class=&quot;boxcheckbox&quot; /&gt;<br />
            &lt;/p&gt;<br />
        &lt;/li&gt;<br />
        &lt;li&gt;<br />
            &lt;p class=&quot;boxcontainer&quot;&gt;<br />
                Color Palette III :<br />
                &lt;br /&gt;<br />
                &lt;span class=&quot;simplebox&quot; title=&quot;#F48A8A&quot; style=&quot;background-color: #F48A8A&quot;&gt;&lt;/span&gt;<br />
                &lt;span class=&quot;simplebox&quot; title=&quot;#F57777&quot; style=&quot;background-color: #F57777&quot;&gt;&lt;/span&gt;<br />
                &lt;span class=&quot;simplebox&quot; title=&quot;#FA2A2A&quot; style=&quot;background-color: #FA2A2A&quot;&gt;&lt;/span&gt;<br />
                &lt;span class=&quot;simplebox boxspecialone&quot; title=&quot;#FC0909&quot; style=&quot;background-color: #FC0909&quot;&gt;&lt;/span&gt;<br />
                &lt;span class=&quot;simplebox&quot; title=&quot;#EF0505&quot; style=&quot;background-color: #EF0505&quot;&gt;&lt;/span&gt;<br />
                &lt;span class=&quot;simplebox&quot; title=&quot;#FF0000&quot; style=&quot;background-color: #FF0000&quot;&gt;&lt;/span&gt;<br />
                &lt;input type=&quot;checkbox&quot; class=&quot;boxcheckbox&quot; /&gt;<br />
            &lt;/p&gt;<br />
        &lt;/li&gt;<br />
        &lt;li&gt;<br />
            &lt;p class=&quot;boxcontainer&quot;&gt;<br />
                Color Palette IV :<br />
                &lt;br /&gt;<br />
                &lt;span class=&quot;simplebox&quot; title=&quot;#C3A1E9&quot; style=&quot;background-color: #C3A1E9&quot;&gt;&lt;/span&gt;<br />
                &lt;span class=&quot;simplebox&quot; title=&quot;#AF7AEC&quot; style=&quot;background-color: #AF7AEC&quot;&gt;&lt;/span&gt;<br />
                &lt;span class=&quot;simplebox&quot; title=&quot;#A25CF2&quot; style=&quot;background-color: #A25CF2&quot;&gt;&lt;/span&gt;<br />
                &lt;span class=&quot;simplebox boxspecialone&quot; title=&quot;#8D32F5&quot; style=&quot;background-color: #8D32F5&quot;&gt;&lt;/span&gt;<br />
                &lt;span class=&quot;simplebox&quot; title=&quot;#811CF5&quot; style=&quot;background-color: #811CF5&quot;&gt;&lt;/span&gt;<br />
                &lt;span class=&quot;simplebox&quot; title=&quot;#790AF9&quot; style=&quot;background-color: #790AF9&quot;&gt;&lt;/span&gt;<br />
                &lt;input type=&quot;checkbox&quot; class=&quot;boxcheckbox&quot; /&gt;<br />
            &lt;/p&gt;<br />
        &lt;/li&gt;<br />
    &lt;/ul&gt;<br />
    &lt;br /&gt;<br />
    &lt;br /&gt;<br />
    &lt;br /&gt;<br />
    &lt;br /&gt;<br />
    &lt;br /&gt;<br />
    &lt;br /&gt;<br />
    &lt;br /&gt;<br />
    &lt;br /&gt;<br />
    &lt;br /&gt;<br />
    &lt;br /&gt;<br />
    &lt;br /&gt;<br />
    &lt;br /&gt;<br />
    &lt;br /&gt;<br />
    &lt;br /&gt;<br />
    &lt;br /&gt;<br />
    &lt;br /&gt;<br />
    &lt;br /&gt;<br />
    &lt;br /&gt;<br />
    Here colors will be changed whenever you select the palette 🙂<br />
    &lt;div id=&quot;checker&quot; class=&quot;outputcontainer&quot;&gt;<br />
    &lt;/div&gt;<br />
&lt;/body&gt;<br />
[/html]</p>
<p>Here what I am doing is, I am creating a ul element and inside that I am creating some p elements with span. Please see that in the preceding HTML element section.</p>
<p>Once you are done with the elements, what would be the next step? Yeah, we need to style them. Please include the following styles.<br />
[css]<br />
&lt;style&gt;<br />
        .simplebox {<br />
            cursor: pointer;<br />
            border: 1px solid #f0f8ff;<br />
            float: left;<br />
            margin: 1px;<br />
            width: 20px;<br />
            height: 20px;<br />
        }  </p>
<p>        .simpleboxdynamic {<br />
            cursor: pointer;<br />
            border: 1px solid #f0f8ff;<br />
            float: left;<br />
            margin: 1px;<br />
            width: 99.3%;<br />
            height: 27px;<br />
            padding: 5px;<br />
            border-radius: 3px;<br />
            text-align: center;<br />
        }  </p>
<p>        .boxspecialone {<br />
            border: 1px solid #ff00ff;<br />
        }  </p>
<p>        .boxcontainer {<br />
            border: 1px solid #ccc;<br />
            width: 165px;<br />
            position: relative;<br />
            height: 50px;<br />
            padding: 2px;<br />
        }  </p>
<p>        .boxcheckbox {<br />
            float: right;<br />
            margin-top: 6px;<br />
        }  </p>
<p>        .outputcontainer {<br />
            border: 1px solid #ccc;<br />
            width: 100%;<br />
            position: relative;<br />
            height: 247px;<br />
            margin-top: 5px;<br />
        }  </p>
<p>        .maincontainer {<br />
            display: none;<br />
        }  </p>
<p>        .containerul {<br />
            position: absolute;<br />
            width: 190px;<br />
            list-style: none;<br />
            margin: 4px;<br />
            /*border: 2px solid #29b8e5;*/<br />
            -webkit-border-radius: 5px;<br />
            -moz-border-radius: 5px;<br />
            border-radius: 5px;<br />
            background-color: #ffffff;<br />
            overflow-y: auto;<br />
            overflow-x: hidden;<br />
            display: block;<br />
            margin-left: 0px;<br />
            z-index: 200;<br />
            height: 305px;<br />
            display: none;<br />
            left: 60px;<br />
        }  </p>
<p>        #changecolor {<br />
            cursor: pointer;<br />
        }<br />
&lt;/style&gt;<br />
[/css]</p>
<p>Our next step is writing the scripts. Please see that below.<br />
[js]<br />
&lt;script&gt;<br />
        $(document).ready(function () {<br />
            $(&quot;#changecolor&quot;).click(function () {<br />
                $(&quot;.containerul&quot;).slideToggle(1000);<br />
            });<br />
            $(&quot;.boxcheckbox&quot;).click(function () {<br />
                $(&quot;#checker&quot;).html(&#8221;);<br />
                //checked true only for the current<br />
                $(&quot;.boxcheckbox&quot;).prop(&quot;checked&quot;, false);<br />
                $(this).prop(&quot;checked&quot;, true);<br />
                //bind colors start<br />
                var colorCount = 0;<br />
                var spans = $(this).parent().find(&#8216;span&#8217;);<br />
                var test = &#8216;&lt;div&gt;&lt;/div&gt;&#8217;;<br />
                $.each(spans, function (key, value) {<br />
                    var color = $(value).attr(&#8216;title&#8217;);<br />
                    var p = &#8216;&lt;p style=&quot;background-color:&#8217; + color + &#8216;&quot; class=&quot;simpleboxdynamic&quot;&gt; Color Key :&#8217; + key + &#8216;&lt;/p&gt;&#8217;;<br />
                    $(&quot;#checker&quot;).append(p);<br />
                });<br />
            });<br />
        });<br />
&lt;/script&gt;<br />
[/js]</p>
<p>In the script, I am calling the checked event of the check boxes inside the p element and whenever a user selects one, I am finding the parent colors and applying that to the output UI.<br />
That is all. Cool, we have done it.</p>
<p><strong>Complete Code</strong></p>
<p>[html]<br />
&lt;!DOCTYPE html&gt;<br />
&lt;html xmlns=&quot;http://www.w3.org/1999/xhtml&quot;&gt;<br />
&lt;head&gt;<br />
    &lt;title&gt;Custom Color Palette &#8211; sibeeshpassion&lt;/title&gt;<br />
    &lt;style&gt;<br />
        .simplebox {<br />
            cursor: pointer;<br />
            border: 1px solid #f0f8ff;<br />
            float: left;<br />
            margin: 1px;<br />
            width: 20px;<br />
            height: 20px;<br />
        }  </p>
<p>        .simpleboxdynamic {<br />
            cursor: pointer;<br />
            border: 1px solid #f0f8ff;<br />
            float: left;<br />
            margin: 1px;<br />
            width: 99.3%;<br />
            height: 27px;<br />
            padding: 5px;<br />
            border-radius: 3px;<br />
            text-align: center;<br />
        }  </p>
<p>        .boxspecialone {<br />
            border: 1px solid #ff00ff;<br />
        }  </p>
<p>        .boxcontainer {<br />
            border: 1px solid #ccc;<br />
            width: 165px;<br />
            position: relative;<br />
            height: 50px;<br />
            padding: 2px;<br />
        }  </p>
<p>        .boxcheckbox {<br />
            float: right;<br />
            margin-top: 6px;<br />
        }  </p>
<p>        .outputcontainer {<br />
            border: 1px solid #ccc;<br />
            width: 100%;<br />
            position: relative;<br />
            height: 247px;<br />
            margin-top: 5px;<br />
        }  </p>
<p>        .maincontainer {<br />
            display: none;<br />
        }  </p>
<p>        .containerul {<br />
            position: absolute;<br />
            width: 190px;<br />
            list-style: none;<br />
            margin: 4px;<br />
            /*border: 2px solid #29b8e5;*/<br />
            -webkit-border-radius: 5px;<br />
            -moz-border-radius: 5px;<br />
            border-radius: 5px;<br />
            background-color: #ffffff;<br />
            overflow-y: auto;<br />
            overflow-x: hidden;<br />
            display: block;<br />
            margin-left: 0px;<br />
            z-index: 200;<br />
            height: 305px;<br />
            display: none;<br />
            left: 60px;<br />
        }  </p>
<p>        #changecolor {<br />
            cursor: pointer;<br />
        }<br />
    &lt;/style&gt;<br />
    &lt;script src=&quot;jquery-1.9.1.js&quot;&gt;&lt;/script&gt;<br />
    &lt;script&gt;<br />
        $(document).ready(function () {<br />
            $(&quot;#changecolor&quot;).click(function () {<br />
                $(&quot;.containerul&quot;).slideToggle(1000);<br />
            });<br />
            $(&quot;.boxcheckbox&quot;).click(function () {<br />
                $(&quot;#checker&quot;).html(&#8221;);<br />
                //checked true only for the current<br />
                $(&quot;.boxcheckbox&quot;).prop(&quot;checked&quot;, false);<br />
                $(this).prop(&quot;checked&quot;, true);<br />
                //bind colors start<br />
                var colorCount = 0;<br />
                var spans = $(this).parent().find(&#8216;span&#8217;);<br />
                var test = &#8216;&lt;div&gt;&lt;/div&gt;&#8217;;<br />
                $.each(spans, function (key, value) {<br />
                    var color = $(value).attr(&#8216;title&#8217;);<br />
                    var p = &#8216;&lt;p style=&quot;background-color:&#8217; + color + &#8216;&quot; class=&quot;simpleboxdynamic&quot;&gt; Color Key :&#8217; + key + &#8216;&lt;/p&gt;&#8217;;<br />
                    $(&quot;#checker&quot;).append(p);<br />
                });<br />
            });<br />
        });<br />
    &lt;/script&gt;<br />
&lt;/head&gt;<br />
&lt;body&gt;<br />
    &lt;header style=&quot;text-align:center&quot;&gt; Custom Color Palette &#8211; sibeeshpassion&lt;/header&gt;  </p>
<p>    &lt;br /&gt;<br />
    &lt;br /&gt;<br />
    &lt;br /&gt;<br />
    &lt;br /&gt;<br />
    &lt;br /&gt;<br />
    &lt;br /&gt;<br />
    Change Series Color:<br />
    &lt;label id=&quot;changecolor&quot; title=&quot;Change Color&quot;&gt;&lt;u&gt;&lt;i&gt;Change Color&lt;/i&gt;&lt;/u&gt;&lt;/label&gt;<br />
    &lt;ul class=&quot;containerul&quot;&gt;<br />
        &lt;li&gt;<br />
            &lt;p class=&quot;boxcontainer&quot;&gt;<br />
                Color Palette I :<br />
                &lt;br /&gt;<br />
                &lt;span class=&quot;simplebox&quot; title=&quot;#F29F98&quot; style=&quot;background-color: #F29F98&quot;&gt;&lt;/span&gt;<br />
                &lt;span class=&quot;simplebox&quot; title=&quot;#F27C72&quot; style=&quot;background-color: #F27C72&quot;&gt;&lt;/span&gt;<br />
                &lt;span class=&quot;simplebox&quot; title=&quot;#F15C4E&quot; style=&quot;background-color: #F15C4E&quot;&gt;&lt;/span&gt;<br />
                &lt;span class=&quot;simplebox boxspecialone&quot; title=&quot;#F03B2A&quot; style=&quot;background-color: #F03B2A&quot;&gt;&lt;/span&gt;<br />
                &lt;span class=&quot;simplebox&quot; title=&quot;#F12815&quot; style=&quot;background-color: #F12815&quot;&gt;&lt;/span&gt;<br />
                &lt;span class=&quot;simplebox&quot; title=&quot;#FF1601&quot; style=&quot;background-color: #FF1601&quot;&gt;&lt;/span&gt;<br />
                &lt;input type=&quot;checkbox&quot; class=&quot;boxcheckbox&quot; /&gt;<br />
            &lt;/p&gt;<br />
        &lt;/li&gt;<br />
        &lt;li&gt;<br />
            &lt;p class=&quot;boxcontainer&quot;&gt;<br />
                Color Palette II :<br />
                &lt;br /&gt;<br />
                &lt;span class=&quot;simplebox&quot; title=&quot;#A3F0BE&quot; style=&quot;background-color: #A3F0BE&quot;&gt;&lt;/span&gt;<br />
                &lt;span class=&quot;simplebox&quot; title=&quot;#7FEBA5&quot; style=&quot;background-color: #7FEBA5&quot;&gt;&lt;/span&gt;<br />
                &lt;span class=&quot;simplebox&quot; title=&quot;#48EB81&quot; style=&quot;background-color: #48EB81&quot;&gt;&lt;/span&gt;<br />
                &lt;span class=&quot;simplebox boxspecialone&quot; title=&quot;#25EB6B&quot; style=&quot;background-color: #25EB6B&quot;&gt;&lt;/span&gt;<br />
                &lt;span class=&quot;simplebox&quot; title=&quot;#14E85E&quot; style=&quot;background-color: #14E85E&quot;&gt;&lt;/span&gt;<br />
                &lt;span class=&quot;simplebox&quot; title=&quot;#03E552&quot; style=&quot;background-color: #03E552&quot;&gt;&lt;/span&gt;<br />
                &lt;input type=&quot;checkbox&quot; class=&quot;boxcheckbox&quot; /&gt;<br />
            &lt;/p&gt;<br />
        &lt;/li&gt;<br />
        &lt;li&gt;<br />
            &lt;p class=&quot;boxcontainer&quot;&gt;<br />
                Color Palette III :<br />
                &lt;br /&gt;<br />
                &lt;span class=&quot;simplebox&quot; title=&quot;#F48A8A&quot; style=&quot;background-color: #F48A8A&quot;&gt;&lt;/span&gt;<br />
                &lt;span class=&quot;simplebox&quot; title=&quot;#F57777&quot; style=&quot;background-color: #F57777&quot;&gt;&lt;/span&gt;<br />
                &lt;span class=&quot;simplebox&quot; title=&quot;#FA2A2A&quot; style=&quot;background-color: #FA2A2A&quot;&gt;&lt;/span&gt;<br />
                &lt;span class=&quot;simplebox boxspecialone&quot; title=&quot;#FC0909&quot; style=&quot;background-color: #FC0909&quot;&gt;&lt;/span&gt;<br />
                &lt;span class=&quot;simplebox&quot; title=&quot;#EF0505&quot; style=&quot;background-color: #EF0505&quot;&gt;&lt;/span&gt;<br />
                &lt;span class=&quot;simplebox&quot; title=&quot;#FF0000&quot; style=&quot;background-color: #FF0000&quot;&gt;&lt;/span&gt;<br />
                &lt;input type=&quot;checkbox&quot; class=&quot;boxcheckbox&quot; /&gt;<br />
            &lt;/p&gt;<br />
        &lt;/li&gt;<br />
        &lt;li&gt;<br />
            &lt;p class=&quot;boxcontainer&quot;&gt;<br />
                Color Palette IV :<br />
                &lt;br /&gt;<br />
                &lt;span class=&quot;simplebox&quot; title=&quot;#C3A1E9&quot; style=&quot;background-color: #C3A1E9&quot;&gt;&lt;/span&gt;<br />
                &lt;span class=&quot;simplebox&quot; title=&quot;#AF7AEC&quot; style=&quot;background-color: #AF7AEC&quot;&gt;&lt;/span&gt;<br />
                &lt;span class=&quot;simplebox&quot; title=&quot;#A25CF2&quot; style=&quot;background-color: #A25CF2&quot;&gt;&lt;/span&gt;<br />
                &lt;span class=&quot;simplebox boxspecialone&quot; title=&quot;#8D32F5&quot; style=&quot;background-color: #8D32F5&quot;&gt;&lt;/span&gt;<br />
                &lt;span class=&quot;simplebox&quot; title=&quot;#811CF5&quot; style=&quot;background-color: #811CF5&quot;&gt;&lt;/span&gt;<br />
                &lt;span class=&quot;simplebox&quot; title=&quot;#790AF9&quot; style=&quot;background-color: #790AF9&quot;&gt;&lt;/span&gt;<br />
                &lt;input type=&quot;checkbox&quot; class=&quot;boxcheckbox&quot; /&gt;<br />
            &lt;/p&gt;<br />
        &lt;/li&gt;<br />
    &lt;/ul&gt;<br />
    &lt;br /&gt;<br />
    &lt;br /&gt;<br />
    &lt;br /&gt;<br />
    &lt;br /&gt;<br />
    &lt;br /&gt;<br />
    &lt;br /&gt;<br />
    &lt;br /&gt;<br />
    &lt;br /&gt;<br />
    &lt;br /&gt;<br />
    &lt;br /&gt;<br />
    &lt;br /&gt;<br />
    &lt;br /&gt;<br />
    &lt;br /&gt;<br />
    &lt;br /&gt;<br />
    &lt;br /&gt;<br />
    &lt;br /&gt;<br />
    &lt;br /&gt;<br />
    &lt;br /&gt;<br />
    Here colors will be changed whenever you select the palette 🙂<br />
    &lt;div id=&quot;checker&quot; class=&quot;outputcontainer&quot;&gt;<br />
    &lt;/div&gt;<br />
&lt;/body&gt;<br />
&lt;/html&gt;<br />
[/html]</p>
<p><strong>Output</strong></p>
<div id="attachment_9211" style="width: 634px" class="wp-caption alignnone"><a href="http://sibeeshpassion.com/wp-content/uploads/2015/03/Create-Custom-Colour-Palette.jpg"><img decoding="async" aria-describedby="caption-attachment-9211" src="http://sibeeshpassion.com/wp-content/uploads/2015/03/Create-Custom-Colour-Palette.jpg" alt="Create Custom Colour Palette" width="624" height="288" class="size-full wp-image-9211" srcset="/wp-content/uploads/2015/03/Create-Custom-Colour-Palette.jpg 624w, /wp-content/uploads/2015/03/Create-Custom-Colour-Palette-300x138.jpg 300w, /wp-content/uploads/2015/03/Create-Custom-Colour-Palette-400x185.jpg 400w" sizes="(max-width: 624px) 100vw, 624px" /></a><p id="caption-attachment-9211" class="wp-caption-text">Create Custom Colour Palette</p></div>
<p><strong>Conclusion</strong></p>
<p>I hope you liked this article. Please provide your valuable suggestions.</p>
<p>Kindest Regards<br />
Sibeesh Venu</p>
]]></content:encoded>
					
					<wfw:commentRss>https://sibeeshpassion.com/creating-custom-color-palette-using-jquery-html5-css/feed/</wfw:commentRss>
			<slash:comments>2</slash:comments>
		
		
			</item>
	</channel>
</rss>
