jQuery same click event for multiple elements

$(‘.class1, .class2’).on(‘click’, some_function); Or: $(‘.class1’).add(‘.class2’).on(‘click’, some_function); This also works with existing objects: const $class1 = $(‘.class1’); const $class2 = $(‘.class2’); $class1.add($class2).on(‘click’, some_function);

jQuery deferreds and promises – .then() vs .done()

The callbacks attached to done() will be fired when the deferred is resolved. The callbacks attached to fail() will be fired when the deferred is rejected. Prior to jQuery 1.8, then() was just syntactic sugar: promise.then( doneCallback, failCallback ) // was equivalent to promise.done( doneCallback ).fail( failCallback ) As of 1.8, then() is an alias … Read more

What are the differences between normal and slim package of jquery?

The short answer taken from the announcement of jQuery 3.0 Final Release : Along with the regular version of jQuery that includes the ajax and effects modules, we’re releasing a “slim” version that excludes these modules. All in all, it excludes ajax, effects, and currently deprecated code. The file size (gzipped) is about 6k smaller, … Read more

Submit a form using jQuery [closed]

It depends on whether you are submitting the form normally or via an AJAX call. You can find lots of information at jquery.com, including documentation with examples. For submitting a form normally, check out the submit() method to at that site. For AJAX, there are many different possibilities, though you probably want to use either … Read more

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)