[英]click event on anchor tag after insertAfter not working
I have added html on run time using .insertAfter()
method of jQuery: 我已经在运行时使用jQuery的
.insertAfter()
方法添加了html:
var options = '<div class="selectyoursize_block" id="selectyoursize_block_left" style="display:none;"><ul><li><a href="#">S</a></li><li><a href="#">M</a></li><li><a href="#">L</a></li><li><a href="#">XL</a></li><li><a href="#">XXL</a></li></ul></div>';
$(options).insertAfter(selector.eq(4)).slideDown();
$("#selectyoursize_block_left a").on("click", function(e){});
But nothing is working. 但是没有任何效果。 Any help would be appreciated.
任何帮助,将不胜感激。
Move the selector to the 2nd parameter selector when calling on
. 打电话时选择移动到第二个参数选择
on
。 Then on first part selector, use an element that doesn't change eg. 然后在第一部分选择器上,使用一个不变的元素,例如。 document.
文献。
$(document).on("click","#selectyoursize_block_left a",function(e){});
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.