<?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>HTML &#8211; Sibeesh Passion</title>
	<atom:link href="https://sibeeshpassion.com/category/html/feed/" rel="self" type="application/rss+xml" />
	<link>https://sibeeshpassion.com</link>
	<description>My passion towards life</description>
	<lastBuildDate>Tue, 27 Feb 2018 06:07:32 +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>HTML &#8211; Sibeesh Passion</title>
	<link>https://sibeeshpassion.com</link>
	<width>32</width>
	<height>32</height>
</image> 
	<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 fetchpriority="high" 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>Client Side Chart Widget in HTML 5: Part 3 (Line Chart)</title>
		<link>https://sibeeshpassion.com/client-side-chart-widget-in-html-5-part-3-line-chart/</link>
					<comments>https://sibeeshpassion.com/client-side-chart-widget-in-html-5-part-3-line-chart/#disqus_thread</comments>
		
		<dc:creator><![CDATA[SibeeshVenu]]></dc:creator>
		<pubDate>Fri, 29 May 2015 19:51:17 +0000</pubDate>
				<category><![CDATA[HTML]]></category>
		<category><![CDATA[chart]]></category>
		<category><![CDATA[HTML5 Chart]]></category>
		<category><![CDATA[JQuery]]></category>
		<category><![CDATA[Line Chart]]></category>
		<guid isPermaLink="false">https://sibeeshpassion.com/?p=1061</guid>

					<description><![CDATA[Introduction I hope you have read my first two articles in this series that explains about loading a Bar chart and Pie chart. If you have not read them then 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) Now we will explain a client-side line chart widget in HTML5. Background Please download the necessary files 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;Line 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.myLine = new Chart(canvasObject).Line(lineChartData, {             responsive: true         });     } Here [&#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 about loading a Bar chart and Pie chart. If you have not read them then please see the following links.</p>
<ul>
<li><span style="color: #0000ff;"><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></span></li>
<li><span style="color: #0000ff;"><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></span></li>
</ul>
<p>Now we will explain a client-side line chart widget in HTML5.</p>
<p><strong>Background<br />
</strong><br />
Please download the necessary files <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;Line 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.myLine = <span class="keyword">new</span> Chart(canvasObject).Line(lineChartData, {</li>
<li>            responsive: <span class="keyword">true</span></li>
<li class="alt">        });</li>
<li>    }</li>
</ol>
</div>
<p>Here we are loading the chart into myChart.</p>
<p>As you can see in the preceding code, lineChartData 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> lineChartData = {</li>
<li>        labels: [<span class="string">&#8220;Monday&#8221;</span>, <span class="string">&#8220;Tuesday&#8221;</span>, <span class="string">&#8220;Wednesday&#8221;</span>, <span class="string">&#8220;Thursday&#8221;</span>, <span class="string">&#8220;Friday&#8221;</span>, <span class="string">&#8220;Saturday&#8221;</span>, <span class="string">&#8220;Sunday&#8221;</span>],</li>
<li class="alt">        datasets: [</li>
<li>                {</li>
<li class="alt">                    label: <span class="string">&#8220;My First dataset&#8221;</span>,</li>
<li>                    fillColor: <span class="string">&#8220;rgba(220,220,220,0.2)&#8221;</span>,</li>
<li class="alt">                    strokeColor: <span class="string">&#8220;rgba(220,220,220,1)&#8221;</span>,</li>
<li>                    pointColor: <span class="string">&#8220;rgba(220,220,220,1)&#8221;</span>,</li>
<li class="alt">                    pointStrokeColor: <span class="string">&#8220;#fff&#8221;</span>,</li>
<li>                    pointHighlightFill: <span class="string">&#8220;#fff&#8221;</span>,</li>
<li class="alt">                    pointHighlightStroke: <span class="string">&#8220;rgba(220,220,220,1)&#8221;</span>,</li>
<li>                    data: [scalingFactor(), scalingFactor(), scalingFactor(), scalingFactor(), scalingFactor(), scalingFactor(), scalingFactor()]</li>
<li class="alt">                },</li>
<li>                {</li>
<li class="alt">                    label: <span class="string">&#8220;My Second dataset&#8221;</span>,</li>
<li>                    fillColor: <span class="string">&#8220;rgba(151,187,205,0.2)&#8221;</span>,</li>
<li class="alt">                    strokeColor: <span class="string">&#8220;rgba(151,187,205,1)&#8221;</span>,</li>
<li>                    pointColor: <span class="string">&#8220;rgba(151,187,205,1)&#8221;</span>,</li>
<li class="alt">                    pointStrokeColor: <span class="string">&#8220;#fff&#8221;</span>,</li>
<li>                    pointHighlightFill: <span class="string">&#8220;#fff&#8221;</span>,</li>
<li class="alt">                    pointHighlightStroke: <span class="string">&#8220;rgba(151,187,205,1)&#8221;</span>,</li>
<li>                    data: [scalingFactor(), scalingFactor(), scalingFactor(), scalingFactor(), scalingFactor(), scalingFactor(), scalingFactor()]</li>
<li class="alt">                }</li>
<li>        ]</li>
<li class="alt"></li>
<li>    }</li>
</ol>
</div>
<p><strong>Properties</strong></p>
<ul>
<li>Labels</li>
<li>Datasets
<ol>
<li>fillColor</li>
<li>strokeColor</li>
<li>pointColor</li>
<li>pointStrokeColor</li>
<li>pointHighlightFill</li>
<li>pointHighlightStroke</li>
<li>data</li>
</ol>
</li>
</ul>
<p>Here you can change the properties as you want.</p>
<p><strong>To generate data</strong></p>
<div class="dp-highlighter">
<div class="bar"></div>
<ol class="dp-c">
<li class="alt"><span class="keyword">var</span> scalingFactor = <span class="keyword">function</span> () { <span class="keyword">return</span> Math.round(Math.random() * 100) };</li>
</ol>
</div>
<p><strong>Complete 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;Line 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> scalingFactor = <span class="keyword">function</span> () { <span class="keyword">return</span> Math.round(Math.random() * 100) };</li>
<li>    <span class="keyword">var</span> lineChartData = {</li>
<li class="alt">        labels: [<span class="string">&#8220;Monday&#8221;</span>, <span class="string">&#8220;Tuesday&#8221;</span>, <span class="string">&#8220;Wednesday&#8221;</span>, <span class="string">&#8220;Thursday&#8221;</span>, <span class="string">&#8220;Friday&#8221;</span>, <span class="string">&#8220;Saturday&#8221;</span>, <span class="string">&#8220;Sunday&#8221;</span>],</li>
<li>        datasets: [</li>
<li class="alt">                {</li>
<li>                    fillColor: <span class="string">&#8220;rgba(220,220,220,0.2)&#8221;</span>,</li>
<li class="alt">                    strokeColor: <span class="string">&#8220;rgba(220,220,220,1)&#8221;</span>,</li>
<li>                    pointColor: <span class="string">&#8220;rgba(220,220,220,1)&#8221;</span>,</li>
<li class="alt">                    pointStrokeColor: <span class="string">&#8220;#fff&#8221;</span>,</li>
<li>                    pointHighlightFill: <span class="string">&#8220;#fff&#8221;</span>,</li>
<li class="alt">                    pointHighlightStroke: <span class="string">&#8220;rgba(220,220,220,1)&#8221;</span>,</li>
<li>                    data: [scalingFactor(), scalingFactor(), scalingFactor(), scalingFactor(), scalingFactor(), scalingFactor(), scalingFactor()]</li>
<li class="alt">                }</li>
<li>        ]</li>
<li class="alt"></li>
<li>    }</li>
<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.myLine = <span class="keyword">new</span> Chart(canvasObject).Line(lineChartData, {</li>
<li>            responsive: <span class="keyword">true</span></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 have created 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-3-line-chart/Images/Output.jpg" alt="Output" /></strong></p>
]]></content:encoded>
					
					<wfw:commentRss>https://sibeeshpassion.com/client-side-chart-widget-in-html-5-part-3-line-chart/feed/</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
			</item>
		<item>
		<title>Client-Side Chart Widget in HTML 5: Part 1 (Bar Chart)</title>
		<link>https://sibeeshpassion.com/client-side-chart-widget-in-html-5-part-1-bar-chart/</link>
					<comments>https://sibeeshpassion.com/client-side-chart-widget-in-html-5-part-1-bar-chart/#disqus_thread</comments>
		
		<dc:creator><![CDATA[SibeeshVenu]]></dc:creator>
		<pubDate>Thu, 29 Jan 2015 19:49:39 +0000</pubDate>
				<category><![CDATA[HTML]]></category>
		<category><![CDATA[JQuery]]></category>
		<category><![CDATA[Bar Chart]]></category>
		<category><![CDATA[Chart.Js]]></category>
		<category><![CDATA[Client Side Chart]]></category>
		<category><![CDATA[Create client side chart]]></category>
		<category><![CDATA[HTML5 Chart]]></category>
		<category><![CDATA[Implement Chart]]></category>
		<category><![CDATA[Load chart]]></category>
		<guid isPermaLink="false">https://sibeeshpassion.com/?p=1041</guid>

					<description><![CDATA[Introduction Hi all, I hope you are fine. Today we will explain a client-side chart widget in HTML 5. Background As in the header, we will work with a client-side chart. For that we have a powerful widget. That is Chart.JS. Please download the necessary files here. Using the code The following is a simple HTML: [html] &#60;!DOCTYPE html&#62; &#60;html xmlns=“http://www.w3.org/1999/xhtml”&#62; &#60;head&#62; &#60;title&#62;Bar Chart Using Chart.js&#60;/title&#62; &#60;/head&#62; &#60;body&#62;&#60;/body&#62; &#60;/html&#62; [/html] Included JavaScript file. [js] &#60;script src=“Chart.js”&#62;&#60;/script&#62; [/js] Call the Chart Function as in the following: [js] window.onload = function () { var canvasObject = document.getElementById(“myChart”).getContext(“2d”); window.myBar = new Chart(canvasObject).Bar(barChartData, { [&#8230;]]]></description>
										<content:encoded><![CDATA[<p><strong>Introduction</strong></p>
<p>Hi all, I hope you are fine. Today we will explain a client-side chart widget in HTML 5.</p>
<p><strong>Background</strong></p>
<p>As in the header, we will work with a client-side chart. For that we have a powerful widget.</p>
<p>That is Chart.JS. Please download the necessary files <a href="http://www.chartjs.org/" rel="nofollow">here</a>.</p>
<p><strong>Using the code</strong></p>
<p>The following is a simple HTML:<br />
[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;Bar Chart Using Chart.js&lt;/title&gt;<br />
&lt;/head&gt;<br />
   &lt;body&gt;&lt;/body&gt;<br />
&lt;/html&gt;<br />
[/html]</p>
<p>Included JavaScript file.</p>
<p>[js]<br />
&lt;script src=“Chart.js”&gt;&lt;/script&gt;<br />
[/js]</p>
<p>Call the Chart Function as in the following:<br />
[js]<br />
window.onload = function () {<br />
        var canvasObject = document.getElementById(“myChart”).getContext(“2d”);<br />
        window.myBar = new Chart(canvasObject).Bar(barChartData, {<br />
            responsive: true<br />
        });<br />
    }<br />
[/js]</p>
<p>Here we are loading the chart into the myChart.</p>
<p>As you can see in the preceding code, <em>barChartData </em>is the data we will load into the chart.</p>
<p>[js]<br />
var barChartData = {<br />
        labels: [“Monday”, “Tuesday”, “Wednesday”, “Thursday”, “Friday”, “Saturday”, “Sunday”],<br />
        datasets: [<br />
            {<br />
                fillColor: “rgba(220,220,220,0.5)”,<br />
                strokeColor: “rgba(220,220,220,0.8)”,<br />
                highlightFill: “rgba(220,220,220,0.75)”,<br />
                highlightStroke: “rgba(220,220,220,1)”,<br />
                data: [scalingFactor(), scalingFactor(), scalingFactor(), scalingFactor(), scalingFactor(), scalingFactor(), scalingFactor()]<br />
            },<br />
            {<br />
                fillColor: “rgba(151,187,205,0.5)”,<br />
                strokeColor: “rgba(151,187,205,0.8)”,<br />
                highlightFill: “rgba(151,187,205,0.75)”,<br />
                highlightStroke: “rgba(151,187,205,1)”,<br />
                data: [scalingFactor(), scalingFactor(), scalingFactor(), scalingFactor(), scalingFactor(), scalingFactor(), scalingFactor()]<br />
            }<br />
        ]<br />
    }<br />
[/js]</p>
<p><strong>Properties</strong></p>
<li>Labels</li>
<li>Datasets
<li>fillColor</li>
<li>strokeColor</li>
<li>highlightFill</li>
<li>highlightStroke</li>
<li>data</li>
<p>Here you can change the properties as you want.</p>
<p>Use the following to generate data:<br />
[js]<br />
var scalingFactor = function () { return Math.round(Math.random() * 100) };<br />
[/js]</p>
<p><strong>Complete Code</strong><br />
[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;Bar Chart Using Chart.js&lt;/title&gt;<br />
    &lt;script src=“Chart.js”&gt;&lt;/script&gt;<br />
    &lt;script&gt;<br />
    var scalingFactor = function () { return Math.round(Math.random() * 100) };<br />
    var barChartData = {<br />
        labels: [“Monday”, “Tuesday”, “Wednesday”, “Thursday”, “Friday”, “Saturday”, “Sunday”],<br />
        datasets: [<br />
            {<br />
                fillColor: “rgba(220,220,220,0.5)”,<br />
                strokeColor: “rgba(220,220,220,0.8)”,<br />
                highlightFill: “rgba(220,220,220,0.75)”,<br />
                highlightStroke: “rgba(220,220,220,1)”,<br />
                data: [scalingFactor(), scalingFactor(), scalingFactor(), scalingFactor(), scalingFactor(), scalingFactor(), scalingFactor()]<br />
            },<br />
            {<br />
                fillColor: “rgba(151,187,205,0.5)”,<br />
                strokeColor: “rgba(151,187,205,0.8)”,<br />
                highlightFill: “rgba(151,187,205,0.75)”,<br />
                highlightStroke: “rgba(151,187,205,1)”,<br />
                data: [scalingFactor(), scalingFactor(), scalingFactor(), scalingFactor(), scalingFactor(), scalingFactor(), scalingFactor()]<br />
            }<br />
        ]<br />
    }<br />
    window.onload = function () {<br />
        var canvasObject = document.getElementById(“myChart”).getContext(“2d”);<br />
        window.myBar = new Chart(canvasObject).Bar(barChartData, {<br />
            responsive: true<br />
        });<br />
    }<br />
    &lt;/script&gt;<br />
&lt;/head&gt;<br />
&lt;body&gt;<br />
    &lt;div&gt;<br />
        &lt;canvas id=“myChart”&gt;&lt;/canvas&gt;<br />
    &lt;/div&gt;<br />
&lt;/body&gt;<br />
&lt;/html&gt;<br />
[/html]</p>
<p><strong>Conclusion</strong></p>
<p>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-1-bar-chart/Images/Output.jpg" alt="Output" /></p>
<p><strong>Conclusion</strong></p>
<p>I hope you liked my article. Please share me your feedback. Thank you.</p>
<p>Kindest Regards<br />
<a href="http://sibeeshpassion.com" target="_blank">Sibeesh venu</a></p>
]]></content:encoded>
					
					<wfw:commentRss>https://sibeeshpassion.com/client-side-chart-widget-in-html-5-part-1-bar-chart/feed/</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
			</item>
		<item>
		<title>Export From HTML Table Using jQuery</title>
		<link>https://sibeeshpassion.com/export-html-table-using-jquery/</link>
					<comments>https://sibeeshpassion.com/export-html-table-using-jquery/#disqus_thread</comments>
		
		<dc:creator><![CDATA[SibeeshVenu]]></dc:creator>
		<pubDate>Wed, 29 Oct 2014 18:55:52 +0000</pubDate>
				<category><![CDATA[Exporting]]></category>
		<category><![CDATA[HTML]]></category>
		<category><![CDATA[HTML5]]></category>
		<category><![CDATA[JQuery]]></category>
		<category><![CDATA[Export Excel]]></category>
		<category><![CDATA[Export From HTML Table]]></category>
		<category><![CDATA[Export HTML]]></category>
		<category><![CDATA[Export PDF]]></category>
		<category><![CDATA[Export PPT]]></category>
		<category><![CDATA[Export Word]]></category>
		<category><![CDATA[JQuery Export]]></category>
		<guid isPermaLink="false">https://sibeeshpassion.com/?p=352</guid>

					<description><![CDATA[[toc] Introduction In this article, we will see how to export from an HTML table using jQuery. We all work in some applications where we are playing with data&#8217;s. It might be some data returned by the server or it might be some client-side data like HTML table. No matter whichever forms the data is, there will be an export option. Isn&#8217;t it? 80% of our clients need the data to be exported to excel. So we need to give the option to export the given data to excel, not dependent on the data format. In my case, my data [&#8230;]]]></description>
										<content:encoded><![CDATA[<p>[toc]</p>
<h2>Introduction</h2>
<p>In this article, we will see how to export from an HTML table using jQuery. We all work in some applications where we are playing with data&#8217;s. It might be some data returned by the server or it might be some client-side data like HTML table. No matter whichever forms the data is, there will be an export option. Isn&#8217;t it? 80% of our clients need the data to be exported to excel. So we need to give the option to export the given data to excel, not dependent on the data format. In my case, my data is in the form of an HTML table, so in this post, we will explain how to export an HTML data to excel, pdf, png, jpeg etc. I hope you will like it.</p>
<p>Download Files here: <a href="https://code.msdn.microsoft.com/Export-From-HTML-Table-c479ff99" target="_blank" rel="noopener">HTML Table Export</a></p>
<h2>Background</h2>
<p>As I said earlier, this article explains how to export an HTML table using jQuery. In this article we will see how we can export the given data to the following formats:</p>
<ul>
<li>Excel</li>
<li>PDF</li>
<li>Image</li>
<li>CSV</li>
<li>PPT</li>
<li>Word</li>
<li>TXT</li>
<li>XML</li>
</ul>
<p>You can always see other exporting related articles here.</p>
<ul>
<li><a href="http://sibeeshpassion.com/export-hierarchical-multi-level-html-table-with-styles-using-jquery/" target="_blank" rel="noopener">Export Hierarchical (Multi-Level) HTML Table </a></li>
<li><a href="http://sibeeshpassion.com/compress-xml-string-variables-in-client-side-and-export-in-html5-using-jquery/" target="_blank" rel="noopener">Compress And Export</a></li>
</ul>
<h2><strong>Why</strong></h2>
<p>In my project, we are doing 80% of our work in the client side. So I decided to implement the export feature in the client side itself. The same can be done using server-side code also but I prefer the client-side one.</p>
<h3><strong>What you must know</strong></h3>
<ul>
<li><a href="http://jquery.com/" target="_blank" rel="noopener">jQuery</a></li>
<li><a href="http://www.w3schools.com/js/" target="_blank" rel="noopener">JavaScript</a></li>
<li><a href="http://www.w3schools.com/css/css3_intro.asp" target="_blank" rel="noopener">CSS 3</a></li>
<li><a href="http://www.w3schools.com/html/" target="_blank" rel="noopener">HTML</a></li>
<li><a href="http://www.tutorialspoint.com/jquery/jquery-dom.htm" target="_blank" rel="noopener">DOM Manipulations in jQuery</a></li>
</ul>
<h3><strong>Using the code</strong></h3>
<p>Before you start, you need to download the necessary files from <a href="https://github.com/kayalshri/tableExport.jquery.plugin" target="_blank" rel="noopener">TableExport.jquery.plugin</a>.</p>
<p>Once you have download the files, you need to include those in your project. Here I am using a MVC4 web application.</p>
<p>[js]<br />
&lt;script src=“~/Contents/jquery-1.9.1.js”&gt;&lt;/script&gt;<br />
&lt;script src=“~/Contents/tableExport.js”&gt;&lt;/script&gt; @*Main file which does export feature *@<br />
&lt;script src=“~/Contents/jquery.base64.js”&gt;&lt;/script&gt; @*Main file which does convert the content to base64 *@<br />
&lt;script src=“~/Contents/html2canvas.js”&gt;&lt;/script&gt; @*Main file which does export to image feature *@<br />
&lt;script src=“~/Contents/jspdf/libs/base64.js”&gt;&lt;/script&gt; @*Main file which does convert the content to base64 for pdf *@<br />
&lt;script src=“~/Contents/jspdf/libs/sprintf.js”&gt;&lt;/script&gt; @*Main file which does export feature for pdf *@<br />
&lt;script src=“~/Contents/jspdf/jspdf.js”&gt;&lt;/script&gt; @*Main file which does export feature for pdf *@<br />
[/js]</p>
<p>Let’s say you have an HTML table as follows:</p>
<p>[html]<br />
&lt;table id=“activity” &gt;<br />
&lt;thead&gt;<br />
&lt;tr&gt;<br />
&lt;th&gt;Name&lt;/th&gt;<br />
&lt;th&gt;Activity on Code Project (%)&lt;/th&gt;<br />
&lt;th&gt;Activity on C# Corner (%)&lt;/th&gt;<br />
&lt;th&gt;Activity on Asp Forum (%)&lt;/th&gt;<br />
&lt;/tr&gt;<br />
&lt;/thead&gt;<br />
&lt;tbody&gt;<br />
&lt;tr&gt;<br />
&lt;td&gt;Sibeesh&lt;/td&gt;<br />
&lt;td&gt;100&lt;/td&gt;<br />
&lt;td&gt;98&lt;/td&gt;<br />
&lt;td&gt;80&lt;/td&gt;<br />
&lt;/tr&gt;<br />
&lt;tr&gt;<br />
&lt;td&gt;Ajay&lt;/td&gt;<br />
&lt;td&gt;90&lt;/td&gt;<br />
&lt;td&gt;0&lt;/td&gt;<br />
&lt;td&gt;50&lt;/td&gt;<br />
&lt;/tr&gt;<br />
&lt;tr&gt;<br />
&lt;td&gt;Ansary&lt;/td&gt;<br />
&lt;td&gt;100&lt;/td&gt;<br />
&lt;td&gt;20&lt;/td&gt;<br />
&lt;td&gt;10&lt;/td&gt;<br />
&lt;/tr&gt;<br />
&lt;tr&gt;<br />
&lt;td&gt;Aghil&lt;/td&gt;<br />
&lt;td&gt;0&lt;/td&gt;<br />
&lt;td&gt;30&lt;/td&gt;<br />
&lt;td&gt;90&lt;/td&gt;<br />
&lt;/tr&gt;<br />
&lt;tr&gt;<br />
&lt;td&gt;Arya&lt;/td&gt;<br />
&lt;td&gt;0&lt;/td&gt;<br />
&lt;td&gt;0&lt;/td&gt;<br />
&lt;td&gt;95&lt;/td&gt;<br />
&lt;/tr&gt;<br />
&lt;/tbody&gt;<br />
&lt;/table&gt;<br />
[/html]</p>
<p>Add some more UI elements for firing the click events.</p>
<p>[html]<br />
&lt;table&gt;<br />
&lt;tr id=“footerExport”&gt;<br />
&lt;td id=“exportexcel”&gt;&lt;img src=“~/icons/xls.png” title=“Export to Excel” /&gt;&lt;/td&gt;<br />
&lt;td id=“exportpdf”&gt;&lt;img src=“~/icons/pdf.png” title=“Export to PDF” /&gt;&lt;/td&gt;<br />
&lt;td id=“exportimage”&gt;&lt;img src=“~/icons/png.png” title=“Export to PNG” /&gt;&lt;/td&gt;<br />
&lt;td id=“exportcsv”&gt;&lt;img src=“~/icons/csv.png” title=“Export to CSV” /&gt;&lt;/td&gt;<br />
&lt;td id=“exportword”&gt;&lt;img src=“~/icons/word.png” title=“Export to Word” /&gt;&lt;/td&gt;<br />
&lt;td id=“exporttxt”&gt;&lt;img src=“~/icons/txt.png” title=“Export to TXT” /&gt;&lt;/td&gt;<br />
&lt;td id=“exportxml”&gt;&lt;img src=“~/icons/xml.png” title=“Export to XML” /&gt;&lt;/td&gt;<br />
&lt;td id=“exportppt”&gt;&lt;img src=“~/icons/ppt.png” title=“Export to PPT” /&gt;&lt;/td&gt;<br />
&lt;/tr&gt;<br />
&lt;/table&gt;<br />
[/html]</p>
<p>Add a few styles to the table to make it viewable.</p>
<p>[css]<br />
&lt;style&gt;<br />
#activity {<br />
text-align:center;border:1px solid #ccc;<br />
}<br />
#activity td{<br />
text-align:center;border:1px solid #ccc;<br />
}<br />
#footerExport td{<br />
cursor:pointer;<br />
text-align:center;border:1px solid #ccc;<br />
border:none;<br />
}<br />
&lt;/style&gt;<br />
[/css]</p>
<p>Now it is time to fire our events 🙂 You can do that as in the following.<br />
[js]<br />
&lt;script&gt;<br />
$(document).ready(function () {<br />
$(‘#exportexcel’).bind(‘click’, function (e) {<br />
$(‘#activity’).tableExport({ type: ‘excel’, escape: ‘false’ });<br />
});<br />
$(‘#exportpdf’).bind(‘click’, function (e) {<br />
$(‘#activity’).tableExport({ type: ‘pdf’, escape: ‘false’ });<br />
});<br />
$(‘#exportimage’).bind(‘click’, function (e) {<br />
$(‘#activity’).tableExport({ type: ‘png’, escape: ‘false’ });<br />
});<br />
$(‘#exportcsv’).bind(‘click’, function (e) {<br />
$(‘#activity’).tableExport({ type: ‘csv’, escape: ‘false’ });<br />
});<br />
$(‘#exportppt’).bind(‘click’, function (e) {<br />
$(‘#activity’).tableExport({ type: ‘powerpoint’, escape: ‘false’ });<br />
});<br />
$(‘#exportxml’).bind(‘click’, function (e) {<br />
$(‘#activity’).tableExport({ type: ‘xml’, escape: ‘false’ });<br />
});<br />
$(‘#exportword’).bind(‘click’, function (e) {<br />
$(‘#activity’).tableExport({ type: ‘doc’, escape: ‘false’ });<br />
});<br />
$(‘#exporttxt’).bind(‘click’, function (e) {<br />
$(‘#activity’).tableExport({ type: ‘txt’, escape: ‘false’ });<br />
});<br />
});<br />
&lt;/script&gt;<br />
[/js]</p>
<p>Please note that you can export to a few more formats in the same way. You can learn more here:tableExport.jquery.plugin.</p>
<h3><strong>Explanation</strong></h3>
<p>Now its time go deeper into that plugin. In the downloaded files you can see a file called tableExport.js. just open that file, you can see some conditions for specific formats. And the default property for exporting as follows.<br />
[js]<br />
var defaults = {<br />
separator: ‘,’,<br />
ignoreColumn: [],<br />
tableName:‘yourTableName’,<br />
type:‘csv’,<br />
pdfFontSize:7,<br />
pdfLeftMargin:20,<br />
escape:‘true’,<br />
htmlContent:‘false’,<br />
consoleLog:‘false’<br />
};<br />
[/js]</p>
<p>You can change these properties depending on your needs as follows.</p>
<p>[js]<br />
var varpdfFontSize= ‘7’;<br />
$(‘#activity’).tableExport({ type: ‘excel’, escape: ‘false’,pdfFontSize:varpdfFontSize});<br />
[/js]</p>
<p>You can try all the properties listed above like this :).</p>
<p>Now in that file you can see an if else if condition that is satisfied for multiple formats. Let me explain for Excel formatting alone.</p>
<p>[js]<br />
var excel=“&lt;table&gt;”;<br />
// Header<br />
$(el).find(‘thead’).find(‘tr’).each(function() {<br />
excel += “&lt;tr&gt;”;<br />
$(this).filter(‘:visible’).find(‘th’).each(function(index,data) {<br />
if ($(this).css(‘display’) != ‘none’){<br />
if(defaults.ignoreColumn.indexOf(index) == -1){<br />
excel += “&lt;td&gt;” + parseString($(this))+ “&lt;/td&gt;”;<br />
}<br />
}<br />
});<br />
excel += ‘&lt;/tr&gt;’;<br />
});<br />
// Row Vs Column<br />
var rowCount=1;<br />
$(el).find(‘tbody’).find(‘tr’).each(function() {<br />
excel += “&lt;tr&gt;”;<br />
var colCount=0;<br />
$(this).filter(‘:visible’).find(‘td’).each(function(index,data) {<br />
if ($(this).css(‘display’) != ‘none’){<br />
if(defaults.ignoreColumn.indexOf(index) == -1){<br />
excel += “&lt;td&gt;”+parseString($(this))+“&lt;/td&gt;”;<br />
}<br />
}<br />
colCount++;<br />
});<br />
rowCount++;<br />
excel += ‘&lt;/tr&gt;’;<br />
});<br />
excel += ‘&lt;/table&gt;’<br />
if(defaults.consoleLog == ‘true’){<br />
console.log(excel);<br />
}<br />
var excelFile = “&lt;html xmlns:o=’urn:schemas-microsoft-com:office:office’ xmlns:x=’urn:schemas-microsoft-com:office:”+defaults.type+“‘ xmlns=’http://www.w3.org/TR/REC-html40′&gt;”;<br />
excelFile += “&lt;head&gt;”;<br />
excelFile += “&lt;!–[if gte mso 9]&gt;”;<br />
excelFile += “&lt;xml&gt;”;<br />
excelFile += “&lt;x:ExcelWorkbook&gt;”;<br />
excelFile += “&lt;x:ExcelWorksheets&gt;”;<br />
excelFile += “&lt;x:ExcelWorksheet&gt;”;<br />
excelFile += “&lt;x:Name&gt;”;<br />
excelFile += “{worksheet}”;<br />
excelFile += “&lt;/x:Name&gt;”;<br />
excelFile += “&lt;x:WorksheetOptions&gt;”;<br />
excelFile += “&lt;x:DisplayGridlines/&gt;”;<br />
excelFile += “&lt;/x:WorksheetOptions&gt;”;<br />
excelFile += “&lt;/x:ExcelWorksheet&gt;”;<br />
excelFile += “&lt;/x:ExcelWorksheets&gt;”;<br />
excelFile += “&lt;/x:ExcelWorkbook&gt;”;<br />
excelFile += “&lt;/xml&gt;”;<br />
excelFile += “&lt;![endif]–&gt;”;<br />
excelFile += “&lt;/head&gt;”;<br />
excelFile += “&lt;body&gt;”;<br />
excelFile += excel;<br />
excelFile += “&lt;/body&gt;”;<br />
excelFile += “&lt;/html&gt;”;<br />
var base64data = “base64,” + $.base64.encode(excelFile);<br />
window.open(‘data:application/vnd.ms-‘+defaults.type+‘;filename=exportData.doc;’ + base64data);<br />
[/js]</p>
<h3><strong>Procedure</strong></h3>
<ul>
<li>Find the UI element (in this case it is our HTML table).</li>
<li>Loop through the rows of the thread for the header information.</li>
<li>Apply a filter to avoid the UI elements that have a display as none <em>(filter(‘:visible’))</em>.</li>
<li>If the UI is visible, append it to the variable <em>(excel += “</em>” + parseString($(this))+ “”;)</li>
<li>The same procedure is done for the row vs column values also. The only difference is, here we are looping through the tbody instead of thread.</li>
<li>After the data is manipulated, data is formulated in the Excel format.</li>
</ul>
<p>You can learn more in the attachment.</p>
<h2><strong>Output</strong></h2>
<div id="attachment_10926" style="width: 300px" class="wp-caption alignnone"><a href="http://sibeeshpassion.com/wp-content/uploads/2014/10/export.png"><img decoding="async" aria-describedby="caption-attachment-10926" class="size-full wp-image-10926" src="http://sibeeshpassion.com/wp-content/uploads/2014/10/export.png" alt="Export From HTML Table" width="290" height="100" /></a><p id="caption-attachment-10926" class="wp-caption-text">Export From HTML Table</p></div>
<h2><strong>Points of Interest</strong></h2>
<p>jquery, CSS, HTML, Export</p>
<h2><strong>History</strong></h2>
<p>1st version: 18-11-2014<br />
2nd Version: 24-11-2014</p>
<h2><strong>Changes did</strong></h2>
<ol>
<li>Added Images to UI elements</li>
<li>Added some export feature</li>
</ol>
<h2><strong>Conclusion</strong></h2>
<p>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>
<h2><strong>Your turn. What do you think?</strong></h2>
<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/export-html-table-using-jquery/feed/</wfw:commentRss>
			<slash:comments>135</slash:comments>
		
		
			</item>
	</channel>
</rss>
