Join Chris Converse for an in-depth discussion in this video Detecting when the drop-down changes, part of Creating an Interactive Map with jQuery.
Now we are ready to start writing our first script. Let's come up to map.js.…Let's add a few lines in here and we're going to start by using jQuery's…$(document).ready() function.…So start with a dollar sign, beginning and ending parentheses.…I am going to type document inside of the parentheses, outside of the…parentheses, type .ready, another set of parentheses, then a semicolon.…Inside of the parentheses for ready, type function, beginning and ending…parentheses, beginning and ending bracket, and let's split that open on the bracket.…
So what the $(document).ready() does is this allows us to have all of…our instructions run after all of the HTML code has been loaded in the page.…So now the first thing I want to do is detect when the map form has actually changed.…So we're going to start by typing a dollar sign, beginning and ending…parentheses, two single quotes inside for a string literal.…We are going to type a pound sign, which is going to reference an ID.…We're going to be referencing the mapForm ID, which is the ID that's attached to…
Take a look at the finished web site here.
- Preparing web graphics
- Creating the main container
- Manipulating links with CSS
- Adding a drop-down menu
- Downloading jQuery and adding interactivity to a project
- Creating city details
- Overriding click events of anchor tags with jQuery