The return value of an event handler determines whether or not the default browser behaviour should take place as well. In the case of clicking on links, this would be following the link, but the difference is most noticeable in form submit handlers, where you can cancel a form submission if the user has made a mistake entering the information.
I don’t believe there is a W3C specification for this. All the ancient JavaScript interfaces like this have been given the nickname “DOM 0”, and are mostly unspecified. You may have some luck reading old Netscape 2 documentation.
The modern way of achieving this effect is to call event.preventDefault()
, and this is specified in the DOM 2 Events specification.
Related Posts:
- How to properly use jsPDF library
- Cannot set property InnerHTML of null [duplicate]
- How to fix “Cannot read property ‘addEventListener’ of null” error [duplicate]
- How do I check whether a checkbox is checked in jQuery?
- jQuery document.createElement equivalent?
- Pure JavaScript equivalent of jQuery’s $.ready() – how to call a function when the page/DOM is ready for it [duplicate]
- How to play audio?
- How can I scroll to an element using jQuery?
- jQuery Get Selected Option From Dropdown
- Include another HTML file in a HTML file
- How to add jQuery code into HTML Page
- What is the meaning of == $0 that is shown in inspect element of google chrome for the selected element [duplicate]
- (change) vs (ngModelChange) in angular
- Bootstrap Dropdown menu is not working
- jquery SlideToggle effect in upward direction?
- Export html table data to Excel using JavaScript / JQuery is not working properly in chrome browser
- Set timeout for ajax (jQuery)
- CSS height 100% percent not working
- TypeError: Cannot Set property ‘onclick’ of null
- Express Render not working return error: No default engine was specified and no extension was provided
- Jquery swipe left or right on mobile
- How to move an element into another element?
- Create table with jQuery – append
- How would I call a javascript function in html?
- Encode HTML entities in JavaScript
- “.addEventListener is not a function” why does this error occur?
- Uncaught TypeError: Cannot read property ‘top’ of undefined
- How to move all HTML element children to another parent using JavaScript?
- Coin toss with JavaScript and HTML
- How to print HTML content on click of a button, but not the page?
- Play an audio file using jQuery when a button is clicked
- Bootstrap 4 Dropdown Menu not working?
- getBoundingClientRect is not a function
- document.getElementsByClassName().innerHTML always returns “undefined”
- Jquery button click() function is not working
- Make iframe automatically adjust height according to the contents without using scrollbar?
- How do I modify the URL without reloading the page?
- Textarea Auto height
- Error: ENOENT: no such file or directory, stat ‘/public/main.html’ at Error (native)
- onClick to get the ID of the clicked button
- HTML text input allow only numeric input
- How to change the buttons text using javascript
- How do I use this JavaScript variable in HTML?
- How to close current tab in a browser window?
- How do I check whether a checkbox is checked in jQuery?
- How to pass parameters using ui-sref in ui-router to controller
- How to create a HTML Cancel button that redirects to a URL
- What does ngf-select do and why is it needed for form validation?
- How to get the selected radio button’s value?
- Creating a div element in jQuery
- Scroll to bottom of div?
- document.getElementById().value doesn’t set the value
- Force div to be topmost element of any and all webpages
- How to run a function when the page is loaded?
- How to display raw JSON data on a HTML page
- Clearing my form inputs after submission
- Get class list for element with jQuery
- Reload an iframe with jQuery
- HTML/Javascript change div content
- How To Save Canvas As An Image With canvas.toDataURL()?
- Video auto play is not working in Safari and Chrome desktop browser
- How to change the buttons text using javascript
- how to display a div triggered by onclick event
- Why is jquery show() not working in example
- How can I use jQuery to run MySQL queries?
- anchor jumping by using javascript
- jQuery scrollTop() method not working
- FormData append not working
- How to change the text of a label?
- Print a div content using Jquery
- JavaScript – Count Number of Visitor for Website
- Get the size of the screen, current web page and browser window
- Using “×” word in html changes to ×
- How do I store an array in localStorage?
- How to enable a disabled checkbox dynamically?
- Fully responsive HTML5 video
- When is a CDATA section necessary within a script tag?
- HTML anchor link – href and onclick both?
- How to create checkbox inside dropdown?
- How can I know which radio button is selected via jQuery?
- Positioning element at center of screen
- “Uncaught TypeError: Illegal invocation” in Chrome
- How to use aria-expanded=”true” to change a css property
- How to wrap the content of the main tinyMCE editor with extra tags
- The value of attribute [ data-type ] must be in double quotes – custom html widget error
- Adding JavaScript to a WordPress website
- How do developers add “Smooth Transitions” to their sites?
- Insert “javascript:void(0);” into URL
- Building a slide down search box in wordpress
- Can I change an external script’s HTML?
- Why is JavaScript being added to header as application/oembed?
- how to let users upload their custom cover image
- Web cover page open when button clicked
- internal anchor links no longer working after upgrade
- Hide CSS class only in single post pages
- How to delay display of page elements until enqueued script has injected html
- Why the images on mi javascript are not found?
- dropdown does not work [closed]
- How do I cycle a JS function in WordPress? [closed]
- Sending GravityForms to custom HTML