####JQuery Quiz Here is your chance to take over Socrates!
Spend 10 minutes on each of the following hacks to the Socrates website. Enter them in the console to make sure it works and then save your results here.
Choose a new pair for each. Add your names to the section you complete.
- Use basic selectors (id, class, element) to choose an element on the page. Use the .css() method to alter at least two CSS properties of this element.
$('#toc_0').text("Hey Justin, let's get a beer");
$("#toc_0").css("color", "purple");
$("#toc_0").css("border", "1px solid black");
$("#toc_0").css("border-radius", "5px");
- Use basic selectors and the find() method to select an image on the page and change it with another image of your choice.
$('body').find("img");
$(images[0]).attr('src', 'http://www.lanacion.com.ve/fotoedicion//2013/11/perro-feo.jpg');
- Use traverse methods to select all instances of a repeated element on the page (like the h3 surrounding the words 'Code Review' ) and use the animate() method to modify it.
$( "h3" ).animate({
fontSize: '50px',
marginLeft: '200px'
}, 700);
- Try to find an element that requires at least three selectors / traverse methods to locate it and then use the .on() method to bind an event handler on these elements (use an event other than click).*/
$('div > ul > li').mouseenter(function() {
$( this ).animate({fontSize: '25px'}, 50 );
});
$('div > ul > li').mouseleave(function() {
$( this ).animate({fontSize: '5px'}, 50 );
});
- Your choice.
$('a').filter(":even").css("color", "red");