I can't get the the conditional to work in this function, any help?
function headupdate(id, name, heading)
{
var order;
if (document.getElementById(heading).value === undefined)
{
order = 1;
}
else
{
order = document.getElementById(heading).value;
}
alert(order);
$.post('headingupdate.php', {id: id, name: name, value: heading, order: order},
function(response)
{
$('#resume').html(response)
}
)
};