Random Quote Generator animation problem

Random Quote Generator animation problem
0.0 0

#1

here is my project-file: https://codepen.io/buzz_lightyear/pen/RjRgER/

my machine works fine but i don’t understand how to use jquery so that each time button is pressed the quotes appear like fadeIn()…

tried but not working it’s commented below in js


#2

If you want to use the JQuery library, then use JQuery for everything in your code. If you get rid of the inline onclick event in your HTML, then you could do the following:

function makeId(){
  var randomNumber = Math.floor(Math.random() * quotes.length);
  $("#main > h1").html(quotes[randomNumber]); 
}

$("#press > button").click(function() {
  $("#main > h1").fadeOut('slow', function() {
    makeId();
    $(this).fadeIn('slow');  
  });
});