Direct and Delegated Event Handlers in jQuery

An alternate title might be: how to bind event handlers to new, or dynamically generated, table rows. When using jQuery, we attach sets of instructions to different parts of an HTML document using selectors. Suppose you wanted to attach some functionality to some text in a table, for example, when you click on a row in a table, it brings up a new table below the first table. This is actually kind of tricky, it turns out that there is a distinction between direct and delegated event handlers.

Continue reading Direct and Delegated Event Handlers in jQuery

Using Sessions in Flask

In this post I’ll provide an example of using session management in Flask. This is useful when you need to recover persistent data across different endpoints in your application. In this example, we set the permanent attribute of the session object to True in order to ensure that the session data lasts indefinitely until it is cleared when the user accesses the root endpoint again. The best practice is to have a timeout on the session data.

Continue reading Using Sessions in Flask