Skip to content

Instantly share code, notes, and snippets.

@villanuv
Forked from dbc-challenges/jquery_quiz.js
Last active December 19, 2015 04:59
Show Gist options
  • Save villanuv/5900956 to your computer and use it in GitHub Desktop.
Save villanuv/5900956 to your computer and use it in GitHub Desktop.
/* 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.
*/
/*1. 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. */
$(".lead").html("Hello World. -Every Programmer");
$(".span4 h3").html("Finished All Tasks");
/*2. Use basic selectors and the find() method to select an image on the page
and change it with another image of your choice. */
$(".user a:first").html('<img src="http://wemakeawesomesh.it/nyancat/nyan.gif" />');
/*3. Use traverse methods to select all instances of a repeated word on the page
(like code) and use the animate() method to modify it.
*/
$('.span9 :not(:has(*))').text(function(i, v) {
return v.replace(/JavaScript/g, 'JavaScript Sucks');
});
$( ".span9" ).click(function(){
$( "#block2" ).animate
/*4. 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).*/
$("a").on("click", function(something){
event.preventDefault();
alert("No Challenges today. Go home.");
}
/*5. Your choice. */
$("a").on("click", function() {
event.preventDefault();
$('body').css("background", "url(http://wemakeawesomesh.it/nyancat/nyan.gif) 60px 60px");
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment