0
如何提取TD的文本內容和每一個存儲到從包含以下內容的另一數組的數組:如何從數組中的元素中提取所有td的文本內容?
//create two element in the array, that store a string containing html code
tablecontentArray[0] = "`<tbody><tr><th>Title 1</th><th>Title 2</th></tr><tr><td>Fruit 1</td><td>Fruit 2</td></tr><tr><th>Title 3</th><th>Title 4</th></tr><tr><td>Fruit 3</td><td>Fruit 4</td></tr></tbody>`"
tablecontentArray[1] = "`<tbody><tr><th>Title 5</th><th>Title 6</th></tr><tr><td>Fruit 5</td><td>Fruit 6</td></tr><tr><th>Title 7</th><th>Title 8</th></tr><tr><td>Fruit 7</td><td>Fruit 8</td></tr></tbody>`"
//loop to extract the td text content from the each element of the tableContentArray and store it into extractedTdArray
extractedTdArray = [];
這太好了。但是如果td是不同的,例如可能包含
設置一個表和推
設置多個表和映射
來源
2017-05-23 01:17:22 cpugourou
你介意說明你的代碼是幹什麼的嗎?這也有助於理解你是否也可以提供小提琴鏈接。 – smuhero
相關問題