I am fairly new to programming in general. Recently, I have started learning jQuery and I have tried making a little 'game' with it. However, I can not find an answer anywhere on how to make a jQuery object trigger a JavaScript event.
My code is:
<!DOCTYPE html>
<head>
<title></title>
<link href='stylesheet.css'/>
<script src="http://code.jquery.com/jquery-1.8.2.js"></script>
<script src="http://code.jquery.com/ui/1.9.1/jquery-ui.js"></script>
<script>
confirm("Are you ready for your race?")
var snd = new Audio("rev1.mp3");
snd.play();
$(function() {
$("#car").draggable();
});
</script>
</head>
<body>
<div id="car">
<div id="top"></div>
<div id="bottom"></div>
<div id="fwheel"></div>
<div id="bwheel"></div>
</div>
<div id="line">
<div id="line1"><img src="#"></div>
<div id="line2"><img src="#"></div>
</div>
</body>
</html>
What I am trying to do here is when the object (which is the div id 'car') reaches 'line2', an alert pops up and a sound plays, but I am not sure how to make that happen.
Thanks in advance.