I am trying to get an object value using the input element, but it is not working, this is what I tried
var operator = new Object();
operator.name = document.getElementById("name").value;
operator.country = document.getElementById("country").value;
operator.occupation = document.getElementById("occupation").value;
operator.status = document.getElementById("status").value;
alert(operator.name + operator.country + operator.occupation + operator.status);
It keeps alerting undefined.
<form action="process.php" method="post" onsubmit="return myValidate()" name="myform">
Name:
Country:
Occupation:
Status: