livefire通过另一个按钮触发Post Comments按钮
Livefyre trigger Post Comments button via another button
我正在开发一个自定义笔记应用程序,当在作者的网站上单击"post note as Livefyre comment"时,应该能够将其内容发布到Livefyre。
我一直试图通过Javascript在外部触发Livefyre小部件上的"Post as comment"按钮,但它没有点击它…
Livefyre Post Comment HTML:
<div class="goog-inline-block fyre-button-right fyre-post-button fyre-post-button-new" role="button" style="-moz-user-select: none;" id=":2n">
<div class="goog-inline-block fyre-button-right-outer-box">
<div class="goog-inline-block fyre-button-right-inner-box">Post comment</div>
</div>
</div>
Javascript部分触发:
<a href="#" id="post_comment">POST COMMENT TRIGGER</a>
$("#post_comment").click(function(){
$(".fyre-post-button-new").trigger("click");
});
有人试过吗?或者这是可能的吗?我希望有人能帮忙!
谢谢!
解决方案是在另一个DOM元素的click事件处理程序中调用感兴趣的DOM元素的click事件。
JS可以像这样:
$(".fyre-post-button-new").click(function(){
alert("Post new button was clicked.")
});
$("#post_comment").click(function(){
$(".fyre-post-button-new").click();
});
工作示例:http://codepen.io/gibron/pen/AzKGj?editors=101
相关文章:
- 如何使用带有动态接受好友按钮的ajax post更新更多的表
- 如何将POST表单按钮转换为链接
- 使用 PHP 生成的按钮生成 POST 请求,这些按钮调用带有参数的 javascript 函数
- 当按下浏览器后退按钮时,如何用相同的post参数激发ajax请求
- 使用POST提交按钮,而不是使用HTML表单
- Javascript-post按钮未禁用-字符计数不起作用
- 我们可以使用post参数点击servlet上的按钮吗
- 单击“更新”按钮后,请求不以“放置”形式进行,而是以“POST”形式发送
- HTML/Javascript/JSP/JSTL:如何使用 POST 数据模拟浏览器的后退按钮
- 通过 PHP 中的对象从提交按钮获取 POST
- 同时发出提交按钮 POST 和 AJAX 调用
- 更改 POST AngularJS 上的按钮样式
- 使用jquery检查的单选按钮在post中没有保持正确的值
- 如何通过点击HTML按钮通过POST请求调用JSON
- 重定向到HTML按钮点击的PHP文件,其中一些数据是通过POST发送的
- 使用MVC 3剃刀中自动生成的post-submit/create按钮发送参数
- 我将如何得到我在PHP post多个提交按钮点击按钮
- Jquery ajax post call, ajax历史和后退按钮
- 禁用按钮并发送POST请求
- Html按钮发送post请求以从表中的.json中检索信息