ASPForums.Net RSS Feedhttp://www.aspforums.net/Handlers/RSS.ashxLatest additions to the content that appears on ASPForums.Net(c) 2019 www.aspforums.com. All rights reserved.Get HTML Table RowIndex on Button Click using JavaScript and jQuery<p>Hi <a class="username" rel="SajidHussa"> SajidHussa</a>,</p> <p>Check this example. Now please take its reference and correct your code.</p> <p><strong><span style="text-decoration: underline;">HTML</span></strong></p> <div class="demo_block"> <pre class="brush: html">&lt;html xmlns=&#34;http://www.w3.org/1999/xhtml&#34;&gt; &lt;head&gt; &lt;title&gt;HTML Table RowIndex&lt;/title&gt; &lt;script type=&#34;text/javascript&#34; src=&#34;https://ajax.googleapis.com/ajax/libs/jquery/1.8.3/jquery.min.js&#34;&gt;&lt;/script&gt; &lt;script type=&#34;text/javascript&#34;&gt; function EditRecordForEditDemo(element) { var rowJavascript = element.parentNode.parentNode; &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; var rowjQuery = $(element).closest(&#34;tr&#34;); &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; alert(&#34;JavaScript Row Index : &#34; + (rowJavascript.rowIndex - 1) + &#34;\njQuery Row Index : &#34; + (rowjQuery[0].rowIndex - 1)); } &lt;/script&gt; &lt;/head&gt; &lt;body&gt; &lt;table border=&#34;1&#34; cellpadding=&#34;1&#34; cellspacing=&#34;1&#34;&gt; &lt;tr&gt; &lt;th&gt;Id&lt;/th&gt; &lt;th&gt;Name&lt;/th&gt; &lt;th&gt;Country&lt;/th&gt; &lt;th&gt;Action&lt;/th&gt; &lt;/tr&gt; &lt;tr&gt; &lt;td&gt;1&lt;/td&gt; &lt;td&gt;John Hammond&lt;/td&gt; &lt;td&gt;United States&lt;/td&gt; &lt;td&gt;&lt;input type=&#34;button&#34; value=&#34;Show&#34; class=&#34;imgbtnedit&#34; onclick=&#34;EditRecordForEditDemo(this)&#34; /&gt;&lt;/td&gt; &lt;/tr&gt; &lt;tr&gt; &lt;td&gt;2&lt;/td&gt; &lt;td&gt;Mudassar Khan&lt;/td&gt; &lt;td&gt;India&lt;/td&gt; &lt;td&gt;&lt;input type=&#34;button&#34; value=&#34;Show&#34; class=&#34;imgbtnedit&#34; onclick=&#34;EditRecordForEditDemo(this)&#34; /&gt;&lt;/td&gt; &lt;/tr&gt; &lt;tr&gt; &lt;td&gt;3&lt;/td&gt; &lt;td&gt;Suzanne Mathews&lt;/td&gt; &lt;td&gt;France&lt;/td&gt; &lt;td&gt;&lt;input type=&#34;button&#34; value=&#34;Show&#34; class=&#34;imgbtnedit&#34; onclick=&#34;EditRecordForEditDemo(this)&#34; /&gt;&lt;/td&gt; &lt;/tr&gt; &lt;tr&gt; &lt;td&gt;4&lt;/td&gt; &lt;td&gt;Robert Schidner&lt;/td&gt; &lt;td&gt;Russia&lt;/td&gt; &lt;td&gt;&lt;input type=&#34;button&#34; value=&#34;Show&#34; class=&#34;imgbtnedit&#34; onclick=&#34;EditRecordForEditDemo(this)&#34; /&gt;&lt;/td&gt; &lt;/tr&gt; &lt;/table&gt; &lt;/body&gt; &lt;/html&gt;</pre> </div> <p><a class="demo button orange btn btn-red">Demo</a></p>https://www.aspforums.net:443/Threads/692989/Get-HTML-Table-RowIndex-on-Button-Click-using-JavaScript-and-jQuery/https://www.aspforums.net:443/Threads/692989/Get-HTML-Table-RowIndex-on-Button-Click-using-JavaScript-and-jQuery/Fri, 09 Aug 2019 06:32:15 GMT