我想知道是否有任何方法可以触发“点击”。当我按下(或周围)glyphicon图标时,编辑器的事件?
以下是代码:
<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>
由于
答案 0 :(得分:1)
首先给编辑器提供一个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");
}));