简体   繁体   中英

how to get value from hidden input with jquery?

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.

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:

<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?

You should be using Angular to retrieve that value. It will be in the model ( @Model.CheckInDate ).

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.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM