如何在mvc中将输入的文本框值输入到javascript方法中 [英] how to get entered text box value into javascript method in mvc
问题描述
如何将输入的文本框值输入mvc中的javascript方法..
我的代码是
@ 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();
......
}
});
但是我没有得到该方法的任何值...
(document).ready(function(){
function compute(){
var val = document.getElementById (约会日期)。价值;
var dtdate = new Date(val);
var n = dtdate.getDay();
... ...
}
});
但是我m没有得到该方法的任何价值...
尝试这样
var val = document .getElementById(' AppointmentDate'跨度>)值;
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...
(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...
try like this
var val = document.getElementById('AppointmentDate').value;
这篇关于如何在mvc中将输入的文本框值输入到javascript方法中的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!