I have a loop in my view and during the loop I want to pass the value to a jQuery and return the value back to the div.
View
@foreach (var item in Model){
<p>@item.Title;</p>
<div id="timeDisplay" onload="test(@item.DateTime);"></div>
}
jQuery
$(function () {
function test(var datetime){
$("#timeDisplay").html(datetime);
}
});
The load function does work, what am I missing?
testfunction isn't accessible outside of$(document).ready().