Working with jQuery
Explore how to use jQuery within Transcrypt to enhance front-end development in Python. Understand importing external JavaScript libraries, managing events, and applying compiler pragmas to enable seamless interoperability between Python and JavaScript.
We'll cover the following...
Introduction
So far, the only JavaScript functions we have used have been built-in. The next step we want to take is to utilize the functionality of external JavaScript libraries. JavaScript has a vast ecosystem of libraries available for doing web development. As previously mentioned, the philosophy behind Transcrypt is to take advantage of the existence of these libraries that already work in the web browser and use them rather than try and replace them with a Python equivalent. No sense in creating more work for ourselves, right?
There are several ways to accomplish this, the most straightforward being to import a JavaScript library from a hosted source right from our HTML file. This way, we can use the imported objects and call the library’s methods from any of our Python ...