How to set default value null in javascript as we make a db field null.
lastName.value="Null";
But it saves as values given
<html>
<head>
<script type="text/javascript">
function Hello()
{
var a=document.getElementById('nm').value;
alert(a);
document.getElementById('nm').value=null;
alert(document.getElementById('nm').value);
}
</script>
<body>
Name : <input type="text" name="nm" id="nm" />
<input type="button" value="CLick" onclick="Hello()"/>
</body>
</head>
</html>
var person = {
lastname: null,
firstname: null
};
alert(person.lastname === null);
try
lastName.value= undefined;
It will pass null value to server
undefined is not null, and the question never mentions passing values to the server.
lastName.value = null;lastNamean input field? Then uselastName.value = "".undefined, not null.