您的位置:首页 > Web前端 > AngularJS

angularjs ng-click获取当前元素

2017-06-05 11:00 1356 查看
<div>
<input id="dd" type="text" class="form-control"
ng-click="showMenu($event)" ng-model="dept.name" readonly>

<div class="treeview-back"
style="display:none; position: absolute; z-index: 10000; max-height: 230px;background-color: #ffffff;">
<ul id="deptTree" class="ztree" style="margin-top:0; width:260px;"></ul>
</div>
</div>


scope.showMenu = function (event) {
console.log($(event.target).attr('id'));                                        $(event.target).next().css({left:15+'px', top:34+'px',display: "block"}).slideDown("fast");
}


在方法中传入$event,js中通过event.target获取当前元素。
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: