Message from JavaScript discussions

October 2020


var container = $(this);
$('.myClass').on('click', container, function() { ... });


That's not work for me.

I need container and .myClass to be with together with same parent like document.

— Something like:

var container = $(this);
$(document).on('click', '.myClass' + container, function() { ... });

Message permanent page

— container.on('click', '.myClass', func) then

— The first question is: why jQuery in 2020

— $(this).find('.myClass').on('click', func)

— Same as React, Angular etc 2020

— Team vanilla 🤤

— Oh Thanks, So i miss understand this selector:
$('.myClass', container)

Is that means to select all of child elements with myClass class in container parent?

Message permanent page

— Cause of using wordpress theme that its framework using jQuery and I need to develop it :(

— Actually not

— Dem :(