Event delegation is a pattern where a container element has a single event listener that handles events for all descendants...
This is a presentation from 2019-01-21. Summary We want to move away from jQuery in future projects
...triggerNative() that you can use as a drop-in replacement for trigger() (requires Unpoly): jQuery.fn.triggerNative = function(...args) { this.each(function() { up.emit(this, ...args) }) return this } With this you can replace a...
...from propagation and bubbling. A native event is then emitted on the same element: jQuery.fn.enableNativeEvent = function(eventName, convertedPropNames = []) { this.on(eventName, function($event) { // Only convert when there is not already a...
To avoid multiple versions of a package, you can manually maintain a resolutions section in your package.json. We recommend you...
jQuery doesn't store information about event listeners and data values with the element itself. This information is instead stored...
Select2 is a fantastic library for advanced dropdown boxes, but it depends on jQuery. Alternatives Tom Select
...header. On your server, requests will not look like AJAX requests (request.xhr? will be false). jquery-ujs will not set CSRF headers. This is by design and improves security.
...those headers for specific hosts, add this piece of CoffeeScript directly after jQuery (but before jquery-ujs): whitelisted = (url) -> for domain in ["http://trusted.host/", "https://another.trusted.host/"] return true if url.indexOf...
Nearly all jQuery traversal functions ignore elements that are not HTML tags. To work with other type of nodes (like...
...event handler with the following two code lines: $($0).on('click', function() { console.log('Hello') }) jQuery._data($0, "events").click[0].handler // => "function () { console.log('Hello') }" This is useful for debugging...
jquery-timing is a very useful jquery plugin that helps to remove lots of nested anonymous functions. It's API provides you some methods that help you to write readable...
...otherStuffToDo(); }, 1000); }); }, 500); // after $('.some').show().children().doThat() .wait(500) .doSomething().hide() . wait(1000) . otherStuffToDo(); jquery-timing transformed the setTimeout callback into a chainable method. Now the code is easier...
jQuery is still a useful and pragmatic library, but chances are increasingly that you’re not dependent on using it...
jQuery offers many different methods to move a selection through the DOM tree. These are the most important: $element.find(selector...
jQuery's deferred objects behave somewhat like standard promises, but not really. One of many subtle differences is that there...
When you register a delegated event using on (or the deprecated delegate / live), it is somewhat hard to manually trigger...
Attached (see below) is some code to allow using unobtrusive JavaScript on pages fetched with an AJAX call.
The $.cssHooks object provides a way to define functions for getting and setting particular CSS values. It can also be...
Use the click method on the DOM element: let link = document.querySelector('a') link.click()
to create a Gallery that has a name and has_many :images, which in turn have a...
Many jQuery plugins suffer from a good plugin architecture. When you write jQuery plugins you should use the plugin pattern...
General hints on the DOM the root of the DOM is document custom elements inherit from HTMLElement. They need a...
...do instead is to use Sizzle, the selector engine that is embedded into jQuery. jQuery.find (or $.find) is an alias for the Sizzle(...) function, which you can use to select...
...matching ones. The example below is ES6, on ES5 could write something similar using jQuery.grep. let classes = Array.from($element.prop('classList')) let existingModifiers = classes.filter(className => { return className.match(/^is-/) }) $layout.removeClass(existingModifiers.join(' '))
When you want the table headers to always stay around (e.g. because that table is huuuge), use the code below...
The jQuery project is really excited to announce the work that we’ve been doing to bring jQuery to mobile...