Skip welcome & menu and move to editor
Welcome to JS Bin
Load cached copy from
 
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN""http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> 
<html> 
<head>
<script class="jsbin" src="http://ajax.googleapis.com/ajax/libs/jquery/1.4.2/jquery.min.js"></script>
  <script type="text/javascript" src="http://jquery-json.googlecode.com/files/jquery.json-1.3.min.js"></script>   
  </head>
<body> 
  
<div id="uploadedTunes">
  
  <div class="tune">
    <div class="content">
     Title:<input  type="text" name="Title" value="1">
     Length:<input  type="text" name="Length" value="2"> 
    </div>
  </div>
  
  <div class="tune"> 
     <div class="content">
     Title:<input  type="text" name="Title" value="3">
     Length:<input  type="text" name="Length" value="4"> 
    </div>
 </div>
  <div class="tune">
     Title:<input  type="text" name="Title" value="5">
     Length:<input  type="text" name="Length" value="6"> 
  </div>
  
  <div class="tune"> 
     Title:<input  type="text" name="Title" value="7">
     Length:<input  type="text" name="Length" value="8"> 
 </div>
  
 </div>
  </body>
</html>
 
$.fn.serializeObject = function()
{
    var o = {};
    var a = this.serializeArray();
    $.each(a, function() {
        if (o[this.name]) {
            if (!o[this.name].push) {
                o[this.name] = [o[this.name]];
            }
            o[this.name].push(this.value || '');
        } else {
            o[this.name] = this.value || '';
        }
    });
    return o;
};
$(function() {
  
  var tune = [];
  
  $('#uploadedTunes .tune .content').each(function(i , e) { 
    
  $(this).children().attr('class','tune_'+i);
  
  tune.push( $.toJSON( $('.tune_'+i).serializeObject() ) );
  });
  var uploadedTunes = tune.join(",");
  
  alert( uploadedTunes );
  
});
Output 300px

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

Dismiss x
public
Bin info
anonymouspro
0viewers