I have this webpage ( http://reg.nid-moi.gov.iq/registersubmit ) and it contains a form that I would like to auto fill the data of the form by posting function according to the following function parameter in javascript code and source code of the page as the following : Webpage Sourcecode Script : webpage sourcecode script
There are different ways to do it.
<script>
// if you want to fill form on button click
function setInitailFormData(){
//getting the element you want to fill
var inputName = document.getElementsById('inputName');
//setting up the value
inputName.value = "Gohan"
}
//if you want to fill on component mount
window.onload = function setInitailFormData(){
//getting the element you want to fill
var inputName = document.getElementsById('inputName');
//setting up the value
inputName.value = "Gohan"
}
</script>