যখন উপাদান ফোকাস পায় তখন অনফোকাস ইভেন্টটি ট্রিগার হয়। কিভাবে অনফোকাস প্রয়োগ করতে হয় তা শিখতে আপনি নিম্নলিখিত কোডটি চালানোর চেষ্টা করতে পারেন জাভাস্ক্রিপ্টে ইভেন্ট।
উদাহরণ
<!DOCTYPE html> <html> <body> <p>Write below:</p> <input type = "text" onfocus = "newFunc(this)"> <script> function newFunc(x) { x.style.background = "blue"; } </script> </body> </html>