You can check if the selected values text is equal to 'please select' and if so display an alert to the user telling them to select a value with the following code:
function validateForm() {
var elem = document.getElementById("yourElementID");
var selectedText = elem.options[elem.selectedIndex].text;
if (selectedText == "please select") {
alert("Please select a value");
return false;
}
}
The return false;
is important if you are attaching this code to a form submission for validation as it will prevent the form from being submitted.
You can attach this function to your forms onSubmit
event by doing the following:
<form action="..." method="..." onsubmit="return validateForm()">