【发布时间】:2012-12-23 17:17:53
【问题描述】:
我有一段这样的代码。
// HTML file
<div class="box" ng-click="displayinfo()">
click here to display info about this page.
<div class="content" ng-click="displaytext()">
Click here to display text.
</div>
click here to display info about this page.
</div>
// JS file
$scope.displayinfo = function()
{
alert('info');
}
$scope.displaytext = function()
{
alert('Text');
}
问题是在单击“单击此处以显示文本”时,它正在调用这两个函数并显示“文本”和“信息”。但我不想在这里显示“信息”。我无法更改 html div 结构。
怎么做?
【问题讨论】:
-
查找 cancelBubble() javascript 函数
-
从你来自的元素(div)中检查类?
标签: javascript jquery html angularjs