jQuery

Change button text with jQuery

Its essential to change t he button text in some applications . For example Like button. If the current is “Like”, after click on the button it the button text will be “Liked” jquery makes process efficient. <!DOCTYPE html> <html> <head> <script src=”https://code.jquery.com/jquery-3.7.1.min.js”></script> </head> <body> <button class=”like-button”>Like</button> <script> $(document).ready(function(){ $(‘.like-button’).click(function(){ var buttonText = $(this).text(); if […]