get all elements with data attribute jquery in loop code example Example: foreach in the elements with a data attibute jquery $('#Selector option[data-price]').last()