//get the result as array <option value="<?php echo $value['id']; ?>" data-count="5"> </option> var data = $('.myclass').map(function() { return $(this).data('optionid'); }).get();