I'm trying too take off the event from only this
element , if I try $(this).off('event');
they take off event from all elements and $(this).off('click');
don't work
$(document).on('click', '.text', function (event) {
var box = "<div class = 'box'></div>";
$(box).insertAfter("#body");
$(this).off('event');
});
Try:
$(document).on('click', '.text', myEventHandler);
function myEventHandler(e){
$(this).off('click', myEventHandler);
var box = "<div class = 'box'></div>";
$(box).insertAfter("#body");
}
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.