Javascript examples for jQuery:Text
Replace a link text using JavaScript
<html> <head> <meta name="viewport" content="width=device-width, initial-scale=1"> <script type="text/javascript" src="https://code.jquery.com/jquery-3.1.1.js"></script> <script type="text/javascript"> window.onload=function(){/* w w w. ja v a 2s .com*/ $(".link").click(function(e){ e.preventDefault(); $(this).html("New Text"); }); } </script> </head> <body> <div class="maindiv"> <div class="childdiv"> <a href="http://www.java2s.com" class="link" rel="prev">Old Text</a> </div> </div> </body> </html>