按钮在Google+ Plus..js函数在哪里调用?

Buttons in Google+ Plus. Where is the .js function called?

本文关键字:在哪里 调用 函数 js Google+ Plus 按钮      更新时间:2023-09-26

今天我开始发现Google+的HTML代码

当我检查按钮,如"开始Hangout",我看不到javascript代码被调用的函数。看这里:

<div role="button" class="d-s-r tk3N6e-e tk3N6e-e-qc a-b-kh-fs a-kh-fs-e" tabindex="0" style="-webkit-user-select: none; ">Start a hangout</div>

没有onclick()函数

你知道它是怎么工作的吗?也许是Button状态的观察者?这可能吗?

他们可能在外部js文件中将函数绑定到id或类选择器。

我不相信他们使用jQuery(但他们很可能),但这是你在外部js中使用jQuery的方法:

$("#id").click(function() {
  //run onclick code
});

很可能代码的功能方面是在一个单独的javascript文件中定义的。例如,您可以查看jQuery的.bind()函数。