Looping Through the table with jQuery

code to loop through the table with jQuery


<!DOCTYPE html>

<html>

<head>

http://code.jquery.com/jquery-1.5.js

function CountAllChars(val, objIDToShow) {

var len = val.value.length;

 

var strH = “Total Characters Entered : ” ;

var txtToShow = “”;

if (len > 0) {

txtToShow = strH + len.toString();

document.getElementById(objIDToShow).innerHTML = txtToShow;

}

else { document.getElementById(objIDToShow).innerHTML = “”; }

}

 

 

 

function isAnyRowEditAble(tableName, checkBoxIDToCompare) { //QT to show proper styles for edit and delete btns 27 Jan 2015

var iseditable = “0”;

try {

var tableN = ‘#’ + tableName + ‘ > tbody  > tr’;

var trIndex = 0;

$(tableN).each(function () {

 

$(“td”, this).each(function () {

 

$(“input:checkbox”, this).each(function () {

 

 

var checkBoxID = $(this).attr(“id”);

 

debugger;

if (checkBoxID != undefined) {

if (checkBoxID.indexOf(checkBoxIDToCompare) > -1) {

 

if (document.getElementById(checkBoxID) != null) {

if (document.getElementById(checkBoxID).style != null) {

var chkclass = document.getElementById(checkBoxID).style.display;

 

if (chkclass == “none”) {

 

}

else {

iseditable = “1”;

}

 

}

else {

iseditable = “1”;

}

}

 

}

}

 

});

});

 

});

} catch (e) {

alert(‘An error occured.’);

}

return iseditable;

}

function checkisallow(t1, t2) {

alert(isAnyRowEditAble(t1, t2));

}

</head>

 

<body>

<textarea id=”field” onkeyup=”CountAllChars(this,’charNum’)”  onkeydown=”CountAllChars(this,’charNum’)” ></textarea>

 

<table id=”mTable” width=”100%” cellspacing=”5″ cellpadding=”1″ border=”1″ >

<tbody>

<tr>

<td><input type=”checkbox” id=”mchk” /></td>

<td> </td>

<td></td>

<td><input type=”text” id=”txt3″ /></td>

</tr>

<tr>

<td><input type=”checkbox” id=”mchk2″ /></td>

<td></td>

<td></td>

<td><input type=”text” id=”Text3″ /></td>

</tr>

<tr>

<td><input type=”checkbox” id=”Checkbox1″ /></td>

<td></td>

<td></td>

<td><input type=”text” id=”Text6″ /></td>

</tr>

</tbody>

</table>

<br style=”clear:both” />

<a onclick=”javascript:checkisallow(‘mTable’, ‘mchk’)”>check</a>

 

</body>

 

</html>

 


Looping Through the table with jQuery

jquery to loop through table rows and cells, where checkob …
stackoverflow.com/…/jquery-to-loop-through-table-rows-and-cells-wher…
Apr 23, 2013 – UPDATED. I’ve updated your demo: jsfiddle.net/terryyounghk/QS56z/18/. Also, I’ve changed two ^= to *= .
Loop Through Each HTML Table Column and Get the Data …
stackoverflow.com/…/loop-through-each-html-table-column-and-get-the…
Jun 15, 2013 – i’m trying to get the data inside the html
. Basically, i have … Using a nested .each() means that your inner loop is doing one td at a time, …

Iterating through table cells using jquery – Stack Overflow

stackoverflow.com/questions/…/iterating-through-table-cells-using-jquer…

Feb 3, 2012 – When you select td pass the context as tr( this ) so that it will look for td only in the current tr . Try this. $(“#MarketsTable tr”).each(function () { $(‘td’, …

jquery – Looping through table rows – Stack Overflow

stackoverflow.com/questions/20489200/looping-through-table-rows

Dec 10, 2013 – You are not looping through visible tables. Loop through visible tables and inside each table, loop through rows. Try:

Iterate through second columns in a table in jQuery – Stack …

stackoverflow.com/…/iterate-through-second-columns-in-a-table-in-jque…

Jan 24, 2013 – Try this: $(“table tr td:nth-child(2)”).each(function () { }); …

Iterating over table rows – jQuery Forum

forum.jquery.com/topic/iterating-over-table-rows

Feb 25, 2014 – 4 posts – ‎2 authors

jQuery Support Portal.

Looping through a table to read first colum values – jQuery …

forum.jquery.com/…/looping-through-a-table-to-read-first-colum-…

Jan 22, 2012 – 3 posts – ‎1 author

jQuery Support Portal.

Working with Tables Using jQuery – HTML Goodies

http://www.htmlgoodies.com › Beyond HTML › Cascading Style Sheets

Jun 13, 2014 – Difficult for plain JavaScript maybe, but not for jQuery. Its DOM and iteration utility methods allow you to manipulate table cells without having to …

Use for each function to loop through table row … – Java2s

http://www.java2s.com › JavaScript DHTML › jQuery › Table

Use for each function to loop through table row : Table « jQuery « JavaScript DHTML.

jQuery $(selector).each() example – MySampleCode

http://www.mysamplecode.com/2012/05/jquery-selectoreach-example.html

Basically, the jQuery .each() function is used to loop through each element of the … the .each() function that iterates over theelements inside a HTML Table …

Advertisements

~ by UTS on January 28, 2011.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

 
%d bloggers like this: