i created a form using asp.net mvc, i am using entity framework database.on the form there are text fields, how do i add javascript inside a html helper.
bellow is the textfield
@Html.TextAreaFor(m => m.ShortSummary, htmlAttributes: new { onkeyup = UpdateLength(600, "ShortSummary", "count" ) })
<span id="count"></span>
bellow its the function i created to count the number of characters when the user types
<script type="text/javascript">
function UpdateLength(length, textID, spanID) {
var text = document.getElementById(textID);
var span = document.getElementById(spanID);
span.innerHTML = (length - text.value.length);
}
</script>
i want to add the above function to the text field