<?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>Dream House &#187; remove table row</title>
	<atom:link href="http://sajjadhossain.com/tag/remove-table-row/feed/" rel="self" type="application/rss+xml" />
	<link>http://sajjadhossain.com</link>
	<description>Courage to do something...</description>
	<lastBuildDate>Sun, 07 Nov 2010 06:45:09 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3.1</generator>
		<item>
		<title>Removing table rows using JavaScript</title>
		<link>http://sajjadhossain.com/2008/01/12/10/#utm_source=feed&#038;utm_medium=feed&#038;utm_campaign=feed</link>
		<comments>http://sajjadhossain.com/2008/01/12/10/#comments</comments>
		<pubDate>Sat, 12 Jan 2008 07:36:37 +0000</pubDate>
		<dc:creator>Mohammad Sajjad Hossain</dc:creator>
				<category><![CDATA[JavaScript]]></category>
		<category><![CDATA[remove row]]></category>
		<category><![CDATA[remove table row]]></category>

		<guid isPermaLink="false">http://sajjadhossain.com/?p=10</guid>
		<description><![CDATA[In my last post I have shown how to duplicate a table row. Now if you let the user to duplicate a row then you will look for a solution to remove row dynamically using JavaScript. Use the following function to dynamically remove row from a table. This code is also tested on IE6 and [...]
Related posts:<ol>
<li><a href='http://sajjadhossain.com/2008/01/05/duplicating-table-rows-dynamically/' rel='bookmark' title='Duplicating table rows dynamically'>Duplicating table rows dynamically</a></li>
</ol>]]></description>
			<content:encoded><![CDATA[<p>In my last post I have shown how to duplicate a table row. Now if you let the user to duplicate a row then you will look for a solution to remove row dynamically using JavaScript. Use the following function to dynamically remove row from a table. This code is also tested on IE6 and FF2.</p>

<div class="wp_syntax"><div class="code"><pre class="javascript" style="font-family:monospace;"><span style="color: #006600; font-style: italic;">/**
 * Removes row of a table. Finds the table with table ID
 *
 * @param targetTableId - Table ID
 * @param targetRowIndex - index of the target row tobe removed
 * @param skipRows - Number of rows to be skipped
 */</span>
&nbsp;
<span style="color: #003366; font-weight: bold;">function</span> removeRow<span style="color: #009900;">&#40;</span>targetTableId<span style="color: #339933;">,</span> targetRowIndex<span style="color: #339933;">,</span> skipRows<span style="color: #009900;">&#41;</span>
<span style="color: #009900;">&#123;</span>
     <span style="color: #003366; font-weight: bold;">var</span> targetTable <span style="color: #339933;">=</span> document.<span style="color: #660066;">getElementById</span><span style="color: #009900;">&#40;</span>targetTableId<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
     <span style="color: #003366; font-weight: bold;">var</span> tableBody <span style="color: #339933;">=</span> targetTable.<span style="color: #660066;">tBodies</span> <span style="color: #009900;">&#91;</span><span style="color: #CC0000;">0</span><span style="color: #009900;">&#93;</span><span style="color: #339933;">;</span>
     <span style="color: #003366; font-weight: bold;">var</span> totalRows <span style="color: #339933;">=</span> tableBody.<span style="color: #660066;">rows</span>.<span style="color: #660066;">length</span><span style="color: #339933;">;</span>
&nbsp;
     <span style="color: #000066; font-weight: bold;">if</span><span style="color: #009900;">&#40;</span>totalRows <span style="color: #339933;">==</span> skipRows<span style="color: #009900;">&#41;</span>
     <span style="color: #009900;">&#123;</span>
          <span style="color: #000066; font-weight: bold;">return</span> <span style="color: #003366; font-weight: bold;">false</span><span style="color: #339933;">;</span>
     <span style="color: #009900;">&#125;</span>
&nbsp;
     <span style="color: #000066; font-weight: bold;">if</span><span style="color: #009900;">&#40;</span>targetRowIndex <span style="color: #339933;">==</span> undefined <span style="color: #339933;">||</span> targetRowIndex <span style="color: #339933;">==</span> <span style="color: #3366CC;">&quot;&quot;</span><span style="color: #009900;">&#41;</span>   
     <span style="color: #009900;">&#123;</span>       
          targetRowIndex <span style="color: #339933;">=</span> totalRows <span style="color: #339933;">-</span> <span style="color: #CC0000;">1</span><span style="color: #339933;">;</span>   
     <span style="color: #009900;">&#125;</span>    
    
     <span style="color: #000066; font-weight: bold;">if</span><span style="color: #009900;">&#40;</span>tableBody.<span style="color: #660066;">hasChildNodes</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span>   
     <span style="color: #009900;">&#123;</span>
          tableBody.<span style="color: #660066;">removeChild</span><span style="color: #009900;">&#40;</span>tableBody.<span style="color: #660066;">childNodes</span><span style="color: #009900;">&#91;</span>targetRowIndex<span style="color: #009900;">&#93;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>   
     <span style="color: #009900;">&#125;</span>
<span style="color: #009900;">&#125;</span></pre></div></div>

<p><a class="a2a_dd a2a_target addtoany_share_save" href="http://www.addtoany.com/share_save#url=http%3A%2F%2Fsajjadhossain.com%2F2008%2F01%2F12%2F10%2F&amp;title=Removing%20table%20rows%20using%20JavaScript" id="wpa2a_2"><img src="http://sajjadhossain.com/wp-content/plugins/add-to-any/share_save_120_16.png" width="120" height="16" alt="share save 120 16 Removing table rows using JavaScript"  title="Removing table rows using JavaScript" /></a></p><p>Related posts:<ol>
<li><a href='http://sajjadhossain.com/2008/01/05/duplicating-table-rows-dynamically/' rel='bookmark' title='Duplicating table rows dynamically'>Duplicating table rows dynamically</a></li>
</ol></p>]]></content:encoded>
			<wfw:commentRss>http://sajjadhossain.com/2008/01/12/10/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>

