Skip welcome & menu and move to editor
Welcome to JS Bin
Load cached copy from
 
<!DOCTYPE html>
<html>
<head>
<script src="//code.jquery.com/jquery-1.11.1.min.js"></script>
  <meta charset="utf-8">
  <title>Example</title>
</head>
<body>
  <div id="target" class="foo">
    This is the div we'll clone
    <span>- a span within the div</span>
    text after the span
  </div>
<script>
  (function() {
    "use strict";
    
    display($("#target")
              .clone()
              .contents()
              .remove()
              .end()[0].outerHTML);
        
    function display(msg) {
      $("<p>").text(String(msg)).appendTo(document.body);
    }
  })();
</script>
</body>
</html>
Output 300px

You can jump to the latest bin by adding /latest to your URL

Dismiss x
public
Bin info
tjcrowderpro
0viewers