Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

You can use JavaScript to target all form elements except the reset button and attach an onBlur event to them. Here's an example code:

// Get all form elements except reset button
var formElements = document.querySelectorAll('form input:not([type="reset"]), form select, form textarea');

// Attach onBlur event to form elements
formElements.forEach(function(element) {
  element.onblur = function() {
    // Write your onBlur function code here
  }
});

This code uses the querySelectorAll method to select all form elements that are not of type "reset" and attaches an onblur event to them using the forEach method. Inside the function, you can write your own onBlur function code.