The on() method attaches one or more event handlers for the selected elements and child elements.
Read more about jQuery on() Method
As per your code $(document).on('click','#add')
, I guess it’s creating a delegated event.
It will directly fired on #add
id element
Related Posts:
- Cross-Origin Read Blocking (CORB)
- syntax error: unexpected token <
- jQuery equivalent of JavaScript’s addEventListener method
- Infinite Scrolling in Asp.Net MVC with jQuery / AJAX Issues
- ajax jquery simple get request
- jQuery get textarea text
- jQuery AJAX cross domain
- Set timeout for ajax (jQuery)
- How to generate a simple popup using jQuery
- jQuery AJAX submit form
- jQuery Ajax File Upload
- How can I upload files asynchronously with jQuery?
- Adding images to a Bootstrap Carousel with AJAX
- AJAX response error: net::ERR_EMPTY_RESPONSE
- Access Control Request Headers, is added to header in AJAX request with jQuery
- jQuery Ajax POST example with PHP
- Refresh/reload the content in Div using jquery/ajax
- SyntaxError: JSON.parse: unexpected character at line 1 column 1 of the JSON data
- How to manage a redirect request after a jQuery Ajax call
- jQuery checkbox change and click event
- FormData append not working
- Uncaught TypeError: Cannot read property ‘toLowerCase’ of undefined
- Download a file by jQuery.Ajax
- Fire oninput event with jQuery
- Ajax success function
- jQuery checkbox checked state changed event
- List of JS Events for Widgets?
- AJAX not Working with php as supposed
- Toggle show/hide on click with jQuery
- jQuery .on(‘change’, function() {} not triggering for dynamically created inputs
- How to create a jQuery function (a new jQuery method or plugin)?
- Failed to load resource: the server responded with a status of 500 (Internal Server Error) in Bind function
- Scroll to an element with jQuery
- Setting “checked” for a checkbox with jQuery
- Uncaught TypeError: Cannot read property ‘length’ of undefined
- Check if element exists in jQuery
- Checking a Url in Jquery/Javascript
- Uncaught TypeError: $.post is not a function
- When and why to ‘return false’ in JavaScript?
- Send POST data using XMLHttpRequest
- querySelector vs. getElementById
- Fire ontextchanged() event of an asp:TextBox via Javascript
- document.getElementByID is not a function
- Moment js date time comparison
- How to create a JQuery Clock / Timer
- React Js: Uncaught (in promise) SyntaxError: Unexpected token < in JSON at position 0
- How to set ‘X-Frame-Options’ on iframe?
- XMLHttpRequest status 0 (responseText is empty)
- Play an audio file using jQuery when a button is clicked
- How can I get the last character in a string?
- Jquery button click() function is not working
- How to define Global Arrays?
- Disable Chrome strict MIME type checking
- How do I check whether a checkbox is checked in jQuery?
- What is jQuery Unobtrusive Validation?
- jQuery count child elements
- CreateElement with id?
- How do I check if an element is hidden in jQuery?
- Set value of hidden input with jquery
- jQuery equivalent of querySelector
- Convert normal date to unix timestamp
- jQuery replace one class with another
- Clearing my form inputs after submission
- Changing the image source using jQuery
- Reload an iframe with jQuery
- Get the Highlighted/Selected text
- How to get the children of the $(this) selector?
- jQuery: Get selected element tag name
- window.onload vs $(document).ready()
- jQuery scrollTop() method not working
- How to go to a URL using jQuery?
- How to close a window using jQuery
- How can I know which radio button is selected via jQuery?
- jquery toggleClass not working
- jQuery .animate() not working
- How can I capture the right-click event in JavaScript?
- Infinite scroll / lazy loading with NextGen Gallery [closed]
- How to Use JSON With AJAX?
- Using wp_ajax and wp_ajax_nopriv hooks
- Loading posts via AJAX in a hidden div with updated URL?
- Adding JavaScript to a WordPress website
- AJAX request status 200 but no actual “response”
- Save Search System
- dynamic dependent select dropdown
- How do I Import / Upload Files with jQuery AJAX?
- wordpress add_action() issue in ajax call
- wp_mail doesn’t work when logged in?
- Call current post URL in ajax
- Change Query Arguments (filter) with jQuery/Ajax or PHP?
- How to display contact form 7 form in vanilla js without jquery in frontend
- Tracking Visitor LatLng with WordPress using JS, PHP. How to put data which was extract using JS into DB
- Jquery POST Ajax Return null data in wordpress
- Can’t get rid of JQMIGRATE: Migrate is installed, version 3.3.2. Manually updated all the libralies and site. 5.8.2
- internal anchor links no longer working after upgrade
- Admin-ajax.php 404 error
- How to pass values from one function to the other using an array variable
- Ajax sometimes work and sometimes just don’t work
- AJAX to add to cart multiple products woocommerce
- Javascript output now showing in custom widget
- How to submit form data in the same page in WordPress without reloading the page?