Или так
<input type="text" class="cart-add" data-id = "1" data-description = "description" data-photo = "photo" />
<script src='http://code.jquery.com/jquery-latest.js'></script>
<script type="text/javascript">
cart = new Object();
var info = [];
$(document).ready(function() {
$('.cart-add').on('click', add);
function add() {
var id = $(this).attr("data-id");
var description = $(this).attr("data-description");
var photo = $(this).attr("data-photo");
if (cart[id]!=undefined) {
info[0]++;
}
else { info[0]=1;}
info[1] = description;
info[2]= photo;
cart[id] = info;
console.log(JSON.stringify(cart));
}
});
</script>