jquery - On event doesn't work -


a simple question:

when use

$(document).on('click', '.btn-del-top', function(e) {})  

everyhing work, if use

$('.btn-del-top').on('click', function(e) {})  

nothing work.is there explanation?

it because btn-del-top elements created dynamically or created after $('.btn-del-top').on('click', function(e) {}) code executed.

demo1: in case not working because code not inside dom ready


Comments

Popular posts from this blog

matlab - Deleting rows with specific rules -

image - ClassNotFoundException when add a prebuilt apk into system.img in android -