HTML returnValue Event Property

The HTML returnValue event property returns and modify whether the current event is cancelled or not.


Following is the syntax −

1. Returning returnValue


2. Adding returnValue

event.returnValue=”true | false”

Let us see an example of HTML returnValue event property−


 Live Demo

<!DOCTYPE html>
   body {
      color: #000;
      height: 100vh;
      background-color: #FBAB7E;
      background-image: linear-gradient(62deg, #FBAB7E 0%, #F7CE68 100%);
      text-align: center;
   input {
      width: 200px;
      height: 2rem;
   .msg {
      font-size: 1.5rem;
<h1>HTML returnValue Event Property Demo</h1>
<input type="text" placeholder="Enter your name" onfocus="show(event)">
<p class="msg"></p>
   function show(event) {
      document.querySelector('.msg').innerHTML = 'Is onfocus event is active on above input field? ' + event.returnValue;


Now try to enter value in the input field to make it focus so as to display the value of returnValue event property.