I have no idea on how to do this so here it goes. What I need is to be able to just validate for empty fields the with no display none;. I am using prototype.
new.onclick = function() {
if (document.getElementById("ticket").style.display !== "none" &&
document.getElementsByTagName("input").length === 0) {
alert('need to have something here');
}
alert('need here');
};
i think you need to use your if statement this way:
so it will be true if no input is added to the DOM or ticket is display: none
anyway if you dont have an Element with ID ticket, your script will be abortet