-
-
Save SamEureka/0a88d3bb6ea6f943372b to your computer and use it in GitHub Desktop.
Practice Refactoring to jQuery Practice Refactoring to jQuery // source https://jsbin.com/mawase
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!DOCTYPE html> | |
<html> | |
<head> | |
<meta name="description" content="Practice Refactoring to jQuery"> | |
<script src="http://code.jquery.com/jquery-2.1.1.min.js"></script> | |
<meta charset="utf-8"> | |
<title>Practice Refactoring to jQuery</title> | |
<style id="jsbin-css"> | |
#refrigerator { | |
background-color: #FFFFFF; | |
width: 200px; | |
border: 5px solid #333333; | |
} | |
#refrigerator img { | |
width: 100px; | |
display: block; | |
margin: 30px auto; | |
} | |
</style> | |
</head> | |
<body> | |
<div id="refrigerator"> | |
<div class="oranges"> | |
<img src="https://whydyoueatthat.files.wordpress.com/2011/12/oranges-vitamin-c-lg.jpg"> | |
</div> | |
<div class="apples"> | |
<img src="http://lymanorchards.com/files/7013/6725/1487/apples.jpg"> | |
</div> | |
</div> | |
<script id="jsbin-javascript"> | |
$(document).ready(function() { | |
alert("Pick a healthy snack from the refrigerator!"); | |
}); | |
$('.oranges').click(function(){ | |
$(this).css('border', '5px solid orange'); | |
alert('You chose an orange!'); | |
}); | |
$('.apples').click(function(event){ | |
$(this).css('border', '5px solid red'); | |
alert('You chose an apple!'); | |
}); | |
</script> | |
<script id="jsbin-source-html" type="text/html"><!DOCTYPE html> | |
<html> | |
<head> | |
<meta name="description" content="Practice Refactoring to jQuery"> | |
<script src="//code.jquery.com/jquery-2.1.1.min.js"><\/script> | |
<meta charset="utf-8"> | |
<title>Practice Refactoring to jQuery</title> | |
</head> | |
<body> | |
<div id="refrigerator"> | |
<div class="oranges"> | |
<img src="https://whydyoueatthat.files.wordpress.com/2011/12/oranges-vitamin-c-lg.jpg"> | |
</div> | |
<div class="apples"> | |
<img src="http://lymanorchards.com/files/7013/6725/1487/apples.jpg"> | |
</div> | |
</div> | |
</body> | |
</html></script> | |
<script id="jsbin-source-css" type="text/css">#refrigerator { | |
background-color: #FFFFFF; | |
width: 200px; | |
border: 5px solid #333333; | |
} | |
#refrigerator img { | |
width: 100px; | |
display: block; | |
margin: 30px auto; | |
}</script> | |
<script id="jsbin-source-javascript" type="text/javascript"> | |
$(document).ready(function() { | |
alert("Pick a healthy snack from the refrigerator!"); | |
}); | |
$('.oranges').click(function(){ | |
$(this).css('border', '5px solid orange'); | |
alert('You chose an orange!'); | |
}); | |
$('.apples').click(function(event){ | |
$(this).css('border', '5px solid red'); | |
alert('You chose an apple!'); | |
}); | |
</script></body> | |
</html> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#refrigerator { | |
background-color: #FFFFFF; | |
width: 200px; | |
border: 5px solid #333333; | |
} | |
#refrigerator img { | |
width: 100px; | |
display: block; | |
margin: 30px auto; | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$(document).ready(function() { | |
alert("Pick a healthy snack from the refrigerator!"); | |
}); | |
$('.oranges').click(function(){ | |
$(this).css('border', '5px solid orange'); | |
alert('You chose an orange!'); | |
}); | |
$('.apples').click(function(event){ | |
$(this).css('border', '5px solid red'); | |
alert('You chose an apple!'); | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment