繁体   English   中英

铁轨3制作一个 <tr> onclick执行与a:remote =&gt; true链接相同的ajax

[英]rails 3 making a <tr> onclick do the same ajax as a :remote => true link

问题标题非常多地说明了一切。 基本上我试图让每个表的tr元素执行相同的onclick ajax行为,如:remote => true link will。 看起来这将是一件简单的事情,但我只是无法绕过哪条路接近它!

仅供参考,这是一个我希望在tr中模拟的链接示例:

link_to "link text here", stream_item, {:remote => true, "data-toggle" => "modal", 'data-target' => "#commentModal"} %>

我想这种方法要么只是以某种方式使用jquery,要么类似:

<tr onclick="some stuff here">

任何指针都大量赞赏..

谢谢!

我猜你想要能够点击整个表格行,而不仅仅是文本链接。 在这种情况下,您必须按照猜测使用JS事件处理程序。

  $('#myrow').click(function() {
      $('#mymodal).show();
  });

然后分配id:

<tr id="#myrow">Link Text</tr>

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM