Skip welcome & menu and move to editor
Welcome to JS Bin
Load cached copy from
 
<!DOCTYPE html>
<html>
<head>
<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.10.1/jquery.min.js"></script>
<meta charset=utf-8 />
<title>JS Bin</title>
</head>
<body>
  
  
  
  <script type='text/template' id='t'>
  
  <div id="product-123">
    <h3>{Title}</h3>
    <div>
        {Description}
    </div>
    <div>
        {Price}
    </div>
</div>
  </script>
  
</body>
</html>
 
if (!String.prototype.supplant) {
    String.prototype.supplant = function (o) {
        return this.replace(/{([^{}]*)}/g,
            function (a, b) {
                var r = o[b];
                return typeof r === 'string' || typeof r === 'number' ? r : a;
            }
        );
    };
}
 
var Product = {
    'Title': 'Potion of Stamina',
    'Description': 'Restores stamina greatly.',
    'Price': '$100.00'
}
var t= $("#t").clone().html().supplant(Product);
$("body").append(t);
Output

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

Dismiss x
public
Bin info
anonymouspro
0viewers