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
仍然没有工作 –