what is wrong i am doing in JSOUp loop ```TheTable...
# cfml-beginners
g
what is wrong i am doing in JSOUp loop
Copy code
TheTable = HTMLDocument.select("##tableID");
TheTable.addClass("styled-table");
			dateFields = TheTable.select('tr td:nth-child(4)');
			dateFields.forEach( field => {
			  field.innerText.split(/\s/)[0]);
			});
i am trying to remove the second value from the td of each row by looping over it which is seperated by   or space
e
in tag format the correct answer is: <cfset dateFields = TheTable.select('tr td:nth-child(4)')> <cfloop array="#dateFields#" index="field"> <cfset values = ListToArray(field.innerText, " ")> <cfset values = ArrayDeleteAt(values, 2)> <cfset field.innerText = ArrayToList(values, " ")> </cfloop>
g
this should do in cfscript,
Copy code
dateFields = TheTable.select('tr td:nth-child(4)');
for ( field in dateFields ) {
	values = ListToArray(field.innerText, " ");
	values = ArrayDeleteAt(values, 2);
	field.innerText = ArrayToList(values, " ");
}
unless anyone has a better way of doing it more good way
e
See tag script above ;D