How do I iterate through table rows and cells in JavaScript?

前端 未结 9 918
旧时难觅i
旧时难觅i 2020-11-22 13:05

If I have an HTML table...say

<
9条回答
  •  无人及你
    2020-11-22 13:31

    You can consider using jQuery. With jQuery it's super-easy and might look like this:

    $('#mytab1 tr').each(function(){
        $(this).find('td').each(function(){
            //do your stuff, you can use $(this) to get current cell
        })
    })
    

提交回复
热议问题
col1 Val1