Display html link with javascript - Javascript jQuery Method and Property

Javascript examples for jQuery Method and Property:html

Description

Display html link with javascript

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-1.6.4.js"></script> 
  <script type="text/javascript">
    $(function(){/* w  w  w  . j  a  v  a2  s  .c  o  m*/
var span1val = $('#span1').html();
$('#span2').html(span1val);
    });

      </script> 
 </head> 
 <body> 
  <span id="span1"> <a id="idname" class="classname" href="http://www.java2s.com/style/demo/InternetExplorer.png">link-text</a> </span> 
  <p> <span id="span2"></span> </p>  
 </body>
</html>

Related Tutorials