我有以下的代码,我通过一个部分是显示实力标题和强度总结渲染jQuery的事件不是射击通过循环生成的元素
<div id="strengths" class="row">
<% FR_STRENGTHS.each do |strength| %>
<div class="col-xs-12 col-sm-6 col-md-4">
<div >
<h3 class="jobtitle text-center"> <%= strength[1]["title"] %></h3>
<div class="text-justify strength_summary">
<p> <%= strength[1]["summary"] %></p>
</div>
</div>
</div>
<% end %>
</div>
强项
详细信息可在翻译YML文件目的(我的代码与上面的英语待处理参数相同)。 我想隐藏力量摘要并在用户使用Jquery悬停力量标题时显示它,但我无法使其工作。
以下jQuery的传播文件我已经使用这个JS代码:
$(document).ready(function() {
$('#strengths').on("mouseenter", "h3",
function() {
$('.strength_summary').slideDown();
},
function() {
$('.strength_summary').slideUp();
}
);
});
在我不使用类作为“strength_summary”选择,因为我承担所有部分将滑动会的工作认为,任何情况下,徘徊在任何H3时下来?但是这是不可能的,所以... 感谢您的帮助!
的可能的复制[事件绑定的动态创建的元素?(https://stackoverflow.com/questions/203198/event-binding-on-dynamically-created-elements) – 0X0nosugar