Skip to content

Instantly share code, notes, and snippets.

@Ale1
Forked from dbc-challenges/jquery_quiz.js
Last active December 22, 2015 04:29
Show Gist options
  • Save Ale1/6417753 to your computer and use it in GitHub Desktop.
Save Ale1/6417753 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. */
RJ + LB:
$(".feed-actors.span2").children("img") //this selected all of the images but we weren't able to narrow it down
// to the ones for the specific classes.
/*2. Use basic selectors and the find() method to select an image on the page
and change it with another image of your choice. */
RJ + ET
$('#feed-item-id-26655').find('img').attr('src', 'http://www.lolbrary.com/lolpics/900/owl-cuteness-overload-4900.jpg');
$('.feed-actors').find('img').attr('src', 'http://www.quick-break.net/c/2012/11/20/Cuteness_overload_with_this_kitty.jpeg');
// changes all images
/*3. 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.
*/
RJ solo
// didn't get it working
$(".feed-content").has("h3").animate(color: "red");
// this one works
$(".feed-body.span5").find("h3").animate({color: 'black', fontSize: '200%'},1000);
/*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).*/
RJ solo again
//this will find and hide all of the little github icons on the page, not just the one for span class 7
$('.feed-item.span7').find('.icon-github-alt').hide();
/*5. Your choice. */
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment