gpt4 book ai didi

javascript - 在选项指令中触发点击事件

转载 作者:行者123 更新时间:2023-11-27 23:32:49 25 4
gpt4 key购买 nike

我需要在单击选项时触发单击事件。由于某些原因我无法使用更改事件。

这是我的代码

.directive('itemOptions', [
function() {
return {
restrict : 'A',
template : "<option ng-value='item_id'>{{item_name}}</option>",
replace : true,
link : function(scope, element, attrs) {

element.on('click', function() {
//get element value
});
}
}

}
])

点击事件未触发...

任何帮助将不胜感激。请不要更改事件,仅单击事件。谢谢。

最佳答案

尝试

angular.element(element).bind('click',function(){
here get the element ...
})

关于javascript - 在选项指令中触发点击事件,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/34398825/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com