Javascript 使用jquery val()方法调用输入值在MVC视图中空格后不起作用?
这是我的密码: 在我的MVC视图中:Javascript 使用jquery val()方法调用输入值在MVC视图中空格后不起作用?,javascript,c#,jquery,asp.net-mvc,model-view-controller,Javascript,C#,Jquery,Asp.net Mvc,Model View Controller,这是我的密码: 在我的MVC视图中: @ { var datefrom = Model.Vehicle.First().DateFrom.ToString("MMMM yyyy") }; 在我的AjaxBegin中: { <input type="hidden" id="vehicledatefrom" value=@datefrom/> } 这是因为您没有使用引号将值属性括起来 在它遇到一个它认为是它的终结的空间之前,它似乎只拿走
@
{
var datefrom = Model.Vehicle.First().DateFrom.ToString("MMMM yyyy")
};
在我的AjaxBegin中:
{
<input type="hidden" id="vehicledatefrom" value=@datefrom/>
}
这是因为您没有使用
引号将值
属性括起来
在它遇到一个它认为是它的终结的空间之前,它似乎只拿走了价值的第一部分
var datefromto= $('#vehicledatefrom').val() ;
After debugging with break point, the datefrom value is = " July 2006";
But when I am calling the val() in jquery I am getting only "July".
What's the wrong in my code why I am not getting complete value "July 2006";
val() is not taking after the space why any suggestions thanks