.on VS .live with uncreated content
Possible Duplicate:
jQuery .on does not work but .live does
我就是找不到明确的答案。
我曾经使用 $(‘.someclass).live(‘click’, function … ) 来使用 JS 动态创建的项目,这在更新 jQuery 1.9.0 时当然不起作用(谢谢大家)。我一直在环顾四周,找不到一个好的答案。所以,这又是一个问题:
对于动态创建的项目,无需在每次创建新项目时重新分配点击侦听器的情况下,与 .live 等效的是什么?它仍然可以与旧 jQuery 版本完美配合!!
代表,在线和直播是不行的。怎么回事?
试试这个:
1 2 3
|
$(“.someparent”).on(“click”,”.someclass”, function() {
// …
});
|
其中 .someparent 是 .someclass 父元素的选择器。
来源:https://www.codenong.com/14591321/
微信公众号
手机浏览(小程序)
Warning: get_headers(): SSL operation failed with code 1. OpenSSL Error messages:
error:14090086:SSL routines:ssl3_get_server_certificate:certificate verify failed in
/mydata/web/wwwshanhubei/web/wp-content/themes/shanhuke/single.php on line
57
Warning: get_headers(): Failed to enable crypto in
/mydata/web/wwwshanhubei/web/wp-content/themes/shanhuke/single.php on line
57
Warning: get_headers(https://static.shanhubei.com/qrcode/qrcode_viewid_10745.jpg): failed to open stream: operation failed in
/mydata/web/wwwshanhubei/web/wp-content/themes/shanhuke/single.php on line
57