Adding a click listener to the Send Location button

We are going to add a click listener, inside Atom, inside index.js, and we're going to add some code down near the bottom.

Now the first thing I want to do is create a variable, and I'm going to call this variable locationButton; this is going to store our selector. This is the jQuery selector that targets the button we just created, because we're going to need to reference it multiple times and storing it in a variable saves the need to make those calls again. We're going to call jQuery like we've done for our other selectors, passing in one argument, a string, and we're selecting something by ID, which means we got to start with that hash sign (#), and the actual ID is send-location:

Get Advanced Node.js Development now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.