How to submit other properties of the selected option when submitting a select with an form form

how do I get some attributes of the selected option in the select element when submitting with the form form?
for example, foodsid foodsenname foodscnname in the following code, wait for the attribute

<select name="foods" id="foods" class="bottom_add_foods">
    <option foodsid="111" foodsenname="kkk" foodscnname=""></option>
    <option foodsid="222" foodsenname="xxx" foodscnname=""></option>
    <option foodsid="333" foodsenname="hhh" foodscnname=""></option>
</select>
Mar.22,2021

try binding an object with value? For example,

value="{ foodsid: '111', foodsenname: 'kkk', foodscnname: '' }"

then get the value in js and convert the JSON.parse to an object


<select name="foods" id="foods" class="bottom_add_foods">
        <option value="111_kkk_"></option>
        <option value="111_xxx_"></option>
        <option value="333_hhh_"></option>
    </select>

$("- sharpfoods"). Find ("option:selected"). Attr ("foodsid");


option object .getAttribute ("foodsid");

Menu