Click here to Skip to main content
15,885,278 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
https://jsfiddle.net/bsrm0z8L

the code link is provided above; the alert function doesn't display alert

other similar code does

What I have tried:

changed the code several times; added more functions
Posted
Updated 23-Aug-21 2:26am

1 solution

There is no alert in the code you linked to. Javascript won't magically decide to display an alert on its own; you need to tell it what to display and when.

Window.alert() - Web APIs | MDN[^]
 
Share this answer
 
Comments
four systems 23-Aug-21 8:33am    
if ( correctCards == 6 )
{
$('#successMessage').show();
$('#successMessage').animate( {
left: '380px',
top: '200px',
width: '400px',
height: '100px',
opacity: 1
} );
}

is the function which should do that
Richard Deeming 23-Aug-21 8:51am    
That's not an alert call; that's showing an element using jQuery.

You have a script error in the console - your second for loop is iterating past the end of the numbers array.

And your if (correctCards == 6) test is outside of your handleDropEvent method, so it only runs once, when the page first loads.
Richard Deeming 23-Aug-21 8:59am    
Your android and science variables are looking for data items called N and H. But the code that creates the elements set a data item called number. And one of them is set to the index, whereas one is set to the letter.

But the biggest problem is that there is no element in the document with the ID successMessage.

Edit fiddle - JSFiddle - Code Playground[^]

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900