我正在尝试将类应用于循环中的所有日期项目。我的代码正在运行,但我 100% 确信我编写代码的方式不正确。可以就代码更改提出一些建议。我想在循环中对日期项使用 FormatDateTime 函数(我自己的函数)。由于这是一个类,我们可以摆脱 jquery 中的 .each 循环吗?
for (int i = 0; i < Value.Count; i++)
{
<tr>
<td class="ModificationDate">@MDate</td>
<td>@Action</td>
<td>@Field</td>
<td>@Value</td>
</tr>
}
<script>
$(document).ready(function () {
$("[class=ModificationDate]").each(function () {
$(this).text(FormatDateTime($(this).text()));
});
});
</script>