// do when DOM is created $(document).ready( function(){ var $thirdLink = $('ul').find('li a').eq(2); var linkText = $thirdLink.text().replace('html','php'); $thirdLink.text(linkText); function showBox() { alert('ready!'); } $('a').addClass('red'); $('#first').click( function(event){ $.get('test2.html', 'a=1&b=2', showBox, 'html'); } ) $('#last').click( function(event){ $(this).animate({left: '+=200px'}, 'slow'); } ) $('#second').click( function(event){ $.ajax( { url: 'test2.html', success: function(response) { // update status element $('#second').after(response); } } ); } ) $("a").click( function(event) { event.preventDefault(); $(this).hide(3000); $(this).removeClass('red'); $(this).addClass('green'); } ); } )