Skip welcome & menu and move to editor
Welcome to JS Bin
Load cached copy from
 
<!DOCTYPE html>
<html>
<head>
<script src="http://cdnjs.cloudflare.com/ajax/libs/lodash.js/2.4.1/lodash.min.js"></script>
<script src="http://code.jquery.com/jquery-2.1.0.min.js"></script>
<script src="http://code.jquery.com/jquery-git2.js"></script>
  <meta charset="utf-8">
  <title>JS Bin</title>
</head>
<body>
  <nav>
        <input type="radio" name="type" value="company" checked>Company
        <input type="radio" name="type" value="product">Product
        <input type="radio" name="type" value="service">Service
        <select name="category_1" multiple>
            <option value="a" selected>a</option>
            <option value="b">b</option>
            <option value="c" selected>c</option>
        </select>
        <select name="category_2" multiple>
            <option value="a" selected>a</option>
            <option value="b" selected>b</option>
            <option value="c">c</option>
        </select>
        <input type="radio" name="startswith" value="a" checked>a
        <input type="radio" name="startswith" value="b">b
        <input type="radio" name="startswith" value="c">c
        <input type="radio" name="startswith" value="num">#
        <input name="keyword" type="text">
    </nav>
</body>
  
</html>
 
var inputs = $('nav :input').serializeArray();
var obj = {};
_.each(inputs, function(val){
  if(obj[val.name]){
     obj[val.name].values.push(val.value);
  }else{
    obj[val.name] = {values: [val.value]};
  }
});
console.log(obj);
Output

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

Dismiss x
public
Bin info
anonymouspro
0viewers