i have a any hidden input element. i want get value from a element. but tis code $('#chin').val()
return ''
. hidden element for keep default value from the cotroller.
我有一个隐藏的输入元素。我想从元素中获取价值。但是tis代码$('#chin')。val()返回''。隐藏元素,用于保持cotroller的默认值。
my code is:
我的代码是:
<input placeholder="تاریخ ورود" class="datepicker" name="from" id="from" value="@Model.FromDate" />
<input ng-model="searchFilters.CheckInDate" name="chin" id="chin" hidden value="@Model.CheckInDate" />
and html is:
和HTML是:
<input ng-model="searchFilters.CheckInDate" name="chin" id="chin" hidden="" value="2016/12/21" class="ng-pristine ng-untouched ng-valid ng-empty">
the input has value. how to get value from this?
输入有价值。如何从中获得价值?
2 个解决方案
#1
1
delete hidden input and Instead it use this code:
删除隐藏的输入,而是使用此代码:
<input placeholder="تاریخ ورود" class="datepicker" name="from" id="from" value="@Model.FromDate" data-gdate="@Model.CheckInDate" />
add data-gdate="@Model.CheckInDate"
into end code.
将data-gdate =“@ Model.CheckInDate”添加到最终代码中。
#2
4
You should be using Angular to retrieve that value. It will be in the model (@Model.CheckInDate
).
您应该使用Angular来检索该值。它将在模型中(@ Model.CheckInDate)。
#1
1
delete hidden input and Instead it use this code:
删除隐藏的输入,而是使用此代码:
<input placeholder="تاریخ ورود" class="datepicker" name="from" id="from" value="@Model.FromDate" data-gdate="@Model.CheckInDate" />
add data-gdate="@Model.CheckInDate"
into end code.
将data-gdate =“@ Model.CheckInDate”添加到最终代码中。
#2
4
You should be using Angular to retrieve that value. It will be in the model (@Model.CheckInDate
).
您应该使用Angular来检索该值。它将在模型中(@ Model.CheckInDate)。