SO-20157635

by Tushar Gupta

HTML

<input type='text' name='order[bill_address_attributes][firstname]' />
<input type='text' name='order[bill_address_attributes][lastname]' />
<input type='text' name='order[bill_address_attributes][phone]' />

JavaScript

var arr =$('input').map(function(){
    return (/\]\[(.+)\]$/g).exec($(this).prop('name'))[1];
}).get();
console.log(arr);