Click here to Skip to main content
15,907,231 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
how to get entered text box value into javascript method in mvc..
my code is
@Html.TextBoxFor(model => model.AppointmentDate, new { id = "AppointmentDate", onPaste = "compute()" }, new { @style = "height:25px;width:100px; border: 1px #ccc solid;" })


<script...
$(document).ready(function () {
function compute() {
var val = document.getElementById("AppointmentDate").value;

var dtdate = new Date(val);

var n = dtdate.getDay();
......

}
});

but i'm not getting any value into that method...
Posted

1 solution

try like this
JavaScript
var val = document.getElementById('AppointmentDate').value;
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900