Try:
Code:
<script type="text/javascript">
$(document).ready(function() {
if ($("#editModeFailedToValidate").length>0){
alert('The Edit-Key did not match, Please try again.');
}
});
</script>
I think I'm right in saying jQuery always returns a selector object regardless of whether a match is found - so if($("#editModeFailedToValidate")) will always return true. Adding the .length property will evaluate the object and its result can then be tested.