Detect wrapped plain text and apply html markup using jquery - Javascript jQuery

Javascript examples for jQuery:Text

Description

Detect wrapped plain text and apply html markup using jquery

Demo Code

ResultView the demo in separate window

<html>
 <head> 
  <meta name="viewport" content="width=device-width, initial-scale=1"> 
  <script type="text/javascript" src="https://code.jquery.com/jquery-2.1.0.js"></script> 
  <script type="text/javascript">
    $(window).load(function(){//from w  w w .j  av  a  2  s  .  c  o  m
$("body").html($("#wrapper").html().replace(/\(([^)]+)\)/, "<a href='https://www.java2s.com/'>$1</a>"));
    });

      </script> 
 </head> 
 <body> 
  <div id="wrapper">
    text (link here) 
  </div>  
 </body>
</html>

Related Tutorials