I have the following JavaScript function in my view page :
<script type="text/javascript">
function func(nam) {
alert(nam);
</script>
My view code for calling this function goes like this on the same page:
@foreach (var item in Model)
{
<script>func(@item.name) </script>
}
It does not produce any result.
I need to call the JavaScript function from within html but it is not happening. Kindly help me through it.
Is there any other way of calling the JavaScript function?
funcfunction