I am not sure which library you are using to show alert here but quick Google did not give me a result that matched your syntax.
So, suggesting couple of other jQuery based alerts/dialog that can be used. Seems you have condition block in place, all you need is to invoke the alert from there.
Try:
Dialog | jQuery UI[
^]
<!doctype html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>jQuery UI Dialog - Default functionality</title>
<link rel="stylesheet" href="//code.jquery.com/ui/1.12.1/themes/base/jquery-ui.css">
<link rel="stylesheet" href="/resources/demos/style.css">
<script src="https://code.jquery.com/jquery-1.12.4.js"></script>
<script src="https://code.jquery.com/ui/1.12.1/jquery-ui.js"></script>
<script>
$( function() {
$( "#dialog" ).dialog();
} );
</script>
</head>
<body>
<div id="dialog" title="Basic dialog">
<p>This is the default dialog which is useful for displaying information. The dialog window can be moved, resized and closed with the 'x' icon.</p>
</div>
</body>
</html>
Another option:
jquery-confirm.js | The multipurpose alert & confirm[
^]
$.alert({
title: 'Alert!',
content: 'Simple alert!',
});
There are many, pick a simple one and use it.
BTW, simplest of it is windows.alert:
Window alert() Method[
^]