Files
g10-m2/FromJavaScriptTojQuery-master/04-jQuery-TraversingMtDOM/03-traversing_sideways/js/script.js

14 lines
420 B
JavaScript
Executable File

//wait until page is ready
$(document).ready(function() {
//sets <a> element within paragraph to yellow
$("p").click(function(){
$(this).children("a").css("background-color", "yellow"); /* returns all the <a> child elements that are
within this paragraph*/
});
// Toggle the visibility of the paragraph when a button is clicked
$("button").click(function(){
$(this).next().slideToggle('slow');
});
});