1

I send the value value to onChange to the input, but I want the value shown in the input to show the label value, not the value.

return (
    <input 
        type="text"
        list="MaterialList"
        name="MaterialId"
        />
    <datalist id="MaterialList">
        <option label="hi" value="0" />
        <option label="hi2" value="1" />
        <option label="hi3" value="2" />
        <option label="hi4" value="3" />
    </datalist>
)

The value should be there because we will need the value value by adding a button later.
I want to make the label show instead of the value value being printed on the input tag, but I don't know how to do it.

lpizzinidev
  • 12,741
  • 2
  • 10
  • 29
minsu123
  • 419
  • 2
  • 8
  • Does this answer your question? [Show datalist labels but submit the actual value](https://stackoverflow.com/questions/29882361/show-datalist-labels-but-submit-the-actual-value) – Zia Yamin Apr 12 '22 at 07:13
  • @ZiaYamin It's similar, but you have to create it using a Hook using react. – minsu123 Apr 13 '22 at 04:17

0 Answers0