-
Book Overview & Buying
-
Table Of Contents
CouchDB and PHP Web Development Beginner's Guide
By :
Let's get our feet wet with a bit of jQuery by adding some code to our master.js file that will allow us to delete posts using JavaScript. Don't be overwhelmed if the syntax of jQuery isn't familiar to you at first; stick with it, and I think you'll be incredibly pleased with the results.
1. Open public/js/master.js, and make sure the jQuery code will run when the page is finished loading by adding a $(document).ready event to our file. This piece of code means that any JavaScript code inside of this function will be run once the page has finished loading:
$(document).ready(function() {
});
2. Now, let's add an event that binds the click event to any button that has the delete class in our HTML. All of the code inside the brackets of function(event) will be run each time one of our delete post buttons is clicked:
$(document).ready(function() {
$('.delete').bind('click', function(event){
});
});
3. Let's prevent...
Change the font size
Change margin width
Change background colour