Search
 
SCRIPT & CODE EXAMPLE
 

JAVASCRIPT

how to trigger on Blur only when clicked outside parent component and not child component in react js

// assign handleBlur to parent's onBlur i.e. <Parent onBlur={handleBlur} />
handleBlur(event) {
    // currentTarget is the parent element, relatedTarget is the clicked element
    if (!event.currentTarget.contains(event.relatedTarget)) {
        // code when clicked outside parent and children components
    }
}
Comment

PREVIOUS NEXT
Code Example
Javascript :: vscode php format brackets 
Javascript :: asyncGenerator 
Javascript :: jquery timeout 
Javascript :: html onrightclick 
Javascript :: https - node load testing- 
Javascript :: trim para remover excesso de espaço  
Javascript :: JavaScript program that on button click displays the current timestamp on screen 
Javascript :: socket io across two different ports 
Javascript :: js variable delete during loading page 
Javascript :: Snail array 
Javascript :: angular disabled spec.ts 
Javascript :: mixed line chart for angular or react 
Javascript :: find component inside tree with enzyme shallow wrapper 
Javascript :: Copy an Array with the Spread Operator 
Javascript :: map object keys javascript 
Javascript :: merge two array with same length as object 
Javascript :: use ES6 import syntax when you enhance the script tag 
Javascript :: xstate vu.js 
Javascript :: how to jump one page to another on specific tab elementor 
Javascript :: Set objects Relation with Strings javascript 
Javascript :: reactrouter 
Javascript :: how to make local storage read only site:stackoverflow.com 
Javascript :: what is clz32 in javascript 
Javascript :: JSX expression with JS template literals 
Javascript :: This shorthand syntax is also known as the concise method syntax. It’s valid to have spaces in the property name. 
Javascript :: how to create dynamic radio button in jquery 
Javascript :: element non empty jquer y check 
Javascript :: prisma single data fetch 
Javascript :: js template literal avoid white spaces 
Javascript :: santance case in javascript 
ADD CONTENT
Topic
Content
Source link
Name
9+6 =