What will be the result of the code?

$('button').on('click', function(){
    this.attr('class', 'clicked');
There will be a TypeError: this.attr is not a function, because 'this' refers to a DOM element

Follow CodeGalaxy

Mobile Beta

Get it on Google Play
Send Feedback
Keep exploring
JavaScript quizzes
Sign Up Now
or Subscribe for future quizzes