Say for example I have
<select>
<option id="4" data-name="tomato" data-length="six">Tomato</option>
<option id="5" data-name="onion" data-length="five">Onion</option>
</select>
I'm trying to call some javascript code later that will take those data-names and length for different variables:
var str = "name=" + jQuery("#data-name").val() + "&length=" + jQuery("#data-length").val();
How would I do this for multiple attributes from the same element?