[英]calling input value using jquery val() method not working after space in my MVC View?
这是我的代码:
在我的MVC视图中:
@
{
var datefrom = Model.Vehicle.First().DateFrom.ToString("MMMM yyyy")
};
在我的AjaxBeginForm中:
{
<input type="hidden" id="vehicledatefrom" value=@datefrom/>
}
我的jQuery:
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
那是因为您还没有使用quotes
将value
属性quotes
。
在遇到它认为是结束的空间之前,似乎只占用了值的第一部分。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.