Skip welcome & menu and move to editor
Welcome to JS Bin
Load cached copy from
 
<!DOCTYPE html>
<html>
<head>
<script src="http://code.jquery.com/jquery-1.9.1.min.js"></script>
<meta charset=utf-8 />
<title>JS Bin</title>
</head>
<body>
  <div id="Element1">this has "quotes" and 'apostrophes' ☺</div>
  <div id="OuterElement"><div id="Element2">check the data-test attribute's value</div></div>
  <h2>Output:</h2>
  <pre id="Output"></pre>
</body>
</html>
$(function () {
  $("#Element2").attr("data-test", $("#Element1").html());
  $("#Output").text($("#OuterElement").html());
});
Output 300px

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

Dismiss x
public
Bin info
anonymouspro
0viewers