Skip welcome & menu and move to editor
Welcome to JS Bin
Load cached copy from
 
<!DOCTYPE html>
<html>
<head>
  <meta charset="utf-8">
  <meta name="viewport" content="width=device-width">
  <title>JS Bin</title>
</head>
<body>
  <select id="product_id" name="product_id" onchange="productIDOnChangeHandler(this)">
    <option value="pid_1">Product 1</option>
    <option value="pid_2">Product 2</option>
    <option value="pid_3">Product 3</option>
    <option value="pid_4">Product 4</option>
  </select>
  <script>
    function productIDOnChangeHandler(t) {
      copy_data(t.form);
      var select = document.getElementById('product_id');
      var index = select.selectedIndex;
      var given_text = select.options[index].value;
      myPurchaseTotal(given_text, 'purchase_total');
    }
    
    function copy_data(form) {
      // Your fn
      console.log(form);
    }
    
    function myPurchaseTotal(given_text, objId){
      // Your fn
      console.log(given_text);
    }
  </script>
</body>
</html>
Output 300px

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

Dismiss x
public
Bin info
anonymouspro
0viewers