Submitting the value of a disabled input field

前端 未结 4 1130
执念已碎
执念已碎 2020-12-23 02:30

I want to disable an input field, but when I submit the form it should still pass the value.

Use case: I am trying to get latitude and longitude from Google Maps and

4条回答
  •  离开以前
    2020-12-23 03:09

    Input elements have a property called disabled. When the form submits, just run some code like this:

    var myInput = document.getElementById('myInput');
    myInput.disabled = true;
    

提交回复
热议问题