My View code is as below where I am calling a javascript function on key up event. I want to pass the control value to javascript function. I tried using 'this' and @this, but it didn't work.
@Html.TextBoxFor(m => m.LeaveDetailsList[0].LeaveTaken, new {id = "numLeaveTaken1", width = "100", @onkeyup = "checkInp2(this);" })
** Edited ** Javascript code:
function checkInp2(ControlId) {
var x = document.getElementById(ControlID).value;
if (isNaN(x)) {
document.getElementById("btnSave").disabled = true;
return false;
}
else {
document.getElementById("btnSave").disabled = false;
}
}
Aucun commentaire:
Enregistrer un commentaire