Skip welcome & menu and move to editor
Welcome to JS Bin
Load cached copy from
 
<!DOCTYPE html>
<html>
<head>
<script src="https://code.jquery.com/jquery-1.9.1.js"></script>
  <meta charset="utf-8">
  <title>JS Bin</title>
</head>
<body>
  <button>Change</button>
<div id="numbers">0,1,2,3,4</div>
</body>
</html>
 
 var element = $('#numbers');                      
$('button').on('click', function(e){
    // https://regex101.com/r/sJ4cV5/1 check-out regex
    var replaced = element.text().replace(/(0)(?!$)/m, "f");    
    element.text(replaced);  
});
Output

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

Dismiss x
public
Bin info
anonymouspro
0viewers