0
我試圖顯示日曆時,我點擊日曆icon.but問題我面臨的是當我點擊任何其他日曆圖標的頁面上它只打開這個特定的日曆propertyPurchaseDate0。使用jquery顯示日曆
$("div").on("click","i.fa-calendar", function(){
debugger;
$("input#propertyPurchaseDate0").focus();
});
$("div").on("click","i.fa-calendar", function(){
debugger;
$("input#lastValuationDate0").focus();
});
<div class="table-row" id="div1">
<div class="table-cell width-12percent margin-top-5px">
@Html.LabelFor(model => model.PurchaseDate)
</div>
<div class="table-cell width-12percent margin-top-5px">
@Html.EditorFor(model => model.PurchaseDate, new { id = "propertyPurchaseDate" + Model.AccountId, @class = "propertypurchaseDate", @onchange = "SetDate(this)" })
</div>
</div>
datetime.cshtml:
@model DateTime?
@{
var dateFormat = Utils.DefaultDateFormat;
var jsDateFormat = dateFormat.Replace("MM", "mm");
var dateString = Model.HasValue ? Model.Value.Date.ToString(dateFormat) : "";
}
<div class="row collapse date" data-date="@dateString" data-date-format="@jsDateFormat">
<div class="small-10 columns no-padding">
<input id="@ViewData["id"]" type="text"
value="@dateString"
placeholder="@jsDateFormat"
class="@ViewData["class"]"
name="@Html.NameForModel()"
onchange="@ViewData["onchange"]" />
</div>
<div class="small-2 columns no-padding" >
<span class="postfix add-on"><i class="fa fa-calendar"></i></span>
</div>
</div>
它不工作:( –
外部和內部的div都是由我給出相同的ID DIV1我改變了它再試一次 – zainul
仍然沒有工作 –