I am trying to find out how I can select an element within the container that I use as a selector. For example I have the following bit of jQuery:
$('.form-wrapper label').on( "focusin", () => {
$('.primary-label', this).addClass('hello');
});
$('.form-wrapper label').on( "focusout", () => {
$('.primary-label', this).removeClass('hello');
});
And then I have the following HTML form:
So when any of the children within my label element is focused on I am trying to add a class or remove a class depending on the focus action. I have tried using $('.primary-label', this) just to target the element within the labelthat has been focused however the class is never added. Any idea how I can use this just to select the primary-label class within the label parent?
Thanks, Nick
