我想使用此函数从我的表中获取最新的日期值。jquery返回表列最近的日期
function getdate() {
var index = $('#csvtext table').find('th:contains("DATE")').index();
var max = 0;
$('#csvtext table tr td:eq(' + index + ')').each(function() {
$this = parseInt($(this).text());
if ($this > max)
max = $this
});
return max;
}
表:
<tbody>
<tr><td>1</td><td>17/10/2017</td><td>CA5533</td></tr>
<tr><td>2</td><td>15/10/2017</td><td>CA5533</td></tr>
</tbody>
问题是max
是我的专栏里DATE
只返回之日起的第一个值。
如何从此列中的所有值返回最近日期的值?
谢谢!
你的表是什么样子? – Vineesh
@Vineesh编辑了代码。尼萨尔,我看到这篇文章,我不能使用这种情况下的代码。 –