UNPKG

jessquery

Version:

Modern JavaScript is pretty good, but typing document.querySelector() is a pain. This is a tiny library that makes DOM manipulation easy. jQuery is around 80kb (30kb gzipped), while this is only around 8kb (3.5kb gzipped). Lots of JSDoc comments so it's s

25 lines (20 loc) 696 B
<!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8" /> <meta name="viewport" content="width=device-width, initial-scale=1.0" /> <title>Error Handling Test</title> </head> <body> <div id="test-div"></div> <script type="module"> import { $, $$, setErrorHandler } from "../index.js" // Setting a custom error handler to demonstrate the captured errors setErrorHandler((error, context) => { document.body.innerHTML += `<p style="color: red;">${error.message}, ${context}</p>` }) $("#nonExistentDiv") $("#test-div").become("Just use .text()! or even .html()!") </script> </body> </html>