var myInput = document.getElementById("customx"); if (myInput && myInput.value) { alert("My input has a value!"); }