Skip to content

Instantly share code, notes, and snippets.

@msh345
Forked from dbc-challenges/jquery_quiz.js
Last active December 22, 2015 03:59
Show Gist options
  • Save msh345/6414108 to your computer and use it in GitHub Desktop.
Save msh345/6414108 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. */
/*2. Use basic selectors and the find() method to select an image on the page
and change it with another image of your choice. */
eugene = ($('.feed-actors.span2').find($("img[alt|='Eugene Filimonov']")))[0]
(eugene).attr("src")
"https://secure.gravatar.com/avatar/40d8933122df133a1cbc1f1a7ab8d353.png?r=PG&d=mm&s=50"
pusher:new application-953774b466cd16acf6d25b9a8ea71e2f.js:32
Object {id: 26535, feedable_type: "CodeReview", updated_at: "2013-09-02T09:10:51-07:00", comments_count: 0, upvotes_count: 0…}
application-953774b466cd16acf6d25b9a8ea71e2f.js:32
$(eugene).attr("src","https://secure.gravatar.com/avatar/383b12471050c1a6857434078a92e62b.png?r=PG&d=mm&s=50")
[
<img alt=​"Eugene Filimonov" src=​"https:​/​/​secure.gravatar.com/​avatar/​383b12471050c1a6857434078a92e62b.png?r=PG&d=mm&s=50" title=​"Eugene Filimonov">​
]
$(img).attr("src","https://secure.gravatar.com/avatar/383b12471050c1a6857434078a92e62b.png?r=PG&d=mm&s=50")
ReferenceError: img is not defined
$("img").attr("src","https://secure.gravatar.com/avatar/383b12471050c1a6857434078a92e62b.png?r=PG&d=mm&s=50")
v.fn.v.init[137]
/*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.
*/
$("h3").animate({color: "blue"},1500,function(){$("h3").animate({color: "black"})})
/*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).*/
$("#feed .feed-item.span7:nth-child(3) .feed-content").on("hover", function() {$("p").css("font-size","150%")})
/*5. Your choice. */
$("#feed .feed-item.span7:nth-child(3) .feed-content").on("hover", function() {$("p").append(alert("hello"))})
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment