jQuery - button not responding to click?

Working on the quote generator, codepen here.

The button (“get-quote”) is not responding to a click. The console is logging the variable and “ready”, but nothing happens upon a click.

Relevant HTML:

   <div class="buttons">
      <a class="button" id="tweet-quote" title="Tweet this quote!" target="_blank">
        Tweet Wisdom
      <button class="button" id="new-quote">More Wisdom</button>

Relevant JS:

var changedtext = "TEXTCHANGED";
var changedauthor ="AUTHORCHANGED";


  $(id="new-quote").click(function (){
                         console.log("clicked") });


Because of the way you are selecting elements by id.
Change $(id="new-quote") to $("#new-quote"). Do the same for all the id selectors.

1 Like

Hello there.

I think you are wanting:


Read more about jQuery Selectors here: https://www.w3schools.com/jquery/jquery_selectors.asp

Hope this helps

1 Like