从 EditorFor 中的 Glyphicon 获取 onclick
Get the onclick from Glyphicon inside EditorFor
我想知道是否有任何方法可以在我按下(或周围)字形图标时触发 EditorFor 的 'click' 事件?
代码如下:
<div class="col-md-10">
@Html.EditorFor(model => model.FullName, new { htmlAttributes = new { @class = "form-control" } })
<span style="font-size:1.5em;" id="f1" class="glyphicon glyphicon-question-sign form-control-feedback"></span>
@Html.ValidationMessageFor(model => model.FullName, "", new { @class = "text-danger" })
</div>
谢谢
首先给EditorFor一个id:
@Html.EditorFor(model => model.FullName, new { htmlAttributes = new { @class = "form-control", @id = "e1" } })
<span style="font-size:1.5em;" id="f1" class="glyphicon glyphicon-question-sign form-control-feedback"></span>
然后使用jQuery如下:
$("#f1").bind("click", (function () {
$("#e1").trigger("click");
}));
我想知道是否有任何方法可以在我按下(或周围)字形图标时触发 EditorFor 的 'click' 事件?
代码如下:
<div class="col-md-10">
@Html.EditorFor(model => model.FullName, new { htmlAttributes = new { @class = "form-control" } })
<span style="font-size:1.5em;" id="f1" class="glyphicon glyphicon-question-sign form-control-feedback"></span>
@Html.ValidationMessageFor(model => model.FullName, "", new { @class = "text-danger" })
</div>
谢谢
首先给EditorFor一个id:
@Html.EditorFor(model => model.FullName, new { htmlAttributes = new { @class = "form-control", @id = "e1" } })
<span style="font-size:1.5em;" id="f1" class="glyphicon glyphicon-question-sign form-control-feedback"></span>
然后使用jQuery如下:
$("#f1").bind("click", (function () {
$("#e1").trigger("click");
}));