JavaScript and the DOM (jQuery) Flashcards
How would you select an HTML class in a javascript file? (JS Code)
Need to put answer
How would you select an HTML element with jQuery?
$(‘.skillset’);
With the help of jQuery how can we make a cool effect where when the website is loaded with a fade in effect?
Use an element which surrounds all of the elements you wish to put the effect on, like so:
$(‘.projects’).hide();
$(‘.skillset’).hide();
$(‘skillset’).fadeIn(1000);
How can make it, so when a button is clicked on the webpage then something happens (EX. Recent Projects is clicked, it changes colors and reveals the projects)?
$(‘.projects-button’).on(‘click’, function (){ $(this).toggleClass(‘active’); $(this) });
If I wanted the text on an element (button) to change when clicked on, how could I add this cool effect?
$(‘projects-button’).on(‘click’, function() { $(this).toggleClass(‘toggleClass’); $(this).text(‘Projects Viewed’); $(this).next().slideToggle(400). });