Why is .nxt not acting as a selector in JQuery
https://code.sololearn.com/WA77a102a0a1 <ul class="quiz" > </ul> <button class="submit " id="submit">go </button> $('document').ready(function(){ $(".submit").click(function(){ $("#submit").text('something'); $('#submit').addClass("nxt"); $('#submit').removeClass('submit'); // $('.quiz').text('i am working'); //console.log($('#submit').hasClass('nxt')); }); $(".nxt").click(function(){ //here is problem console.log($('#submit').hasClass('nxt')); $('.quiz').text('i am not working'); }); }) <button class="nxt" id="submit">something</button> While inspecting <button class="nxt" id="submit">something</button>, it is clear that the nxt class is being added to the button by $('#submit').addClass("nxt");. Then why is the nxt selector not working?