You need to ensure that you have a jQuery reference that is declared prior to you actually using any jQuery code as seen below :
<!-- jQuery Reference (from CDN) -->
<script src="http://code.jquery.com/jquery-latest.js"></script>
<!-- Your jQuery Code -->
<script type="text/javascript">
$(function () {
//When an available seat is clicked on
$('.seat.available').click(function () {
//Toggle selection for this seat
$(this).toggleClass('selected');
});
//When your "Purchase" button is clicked
$("#Purchase").click(function () {
//Grab the selected seats
var selected = $(".seat.selected");
if (selected.length == 0) {
alert("No seats were selected.");
}
else {
alert(selected.length + ' seats were selected. Proceed to Purchase screen.');
//You may want to add some additional properties to store your seat ID within your
//seat <div> elements so that you can read them here (look into HTML5 data-attributes)
}
});
});
</script>
All-Star
114593 Points
18503 Posts
MVP
Re: Display map of clickable buttons and highlight some based on a condiiton
Sep 30, 2013 11:24 AM|Rion Williams|LINK
You need to ensure that you have a jQuery reference that is declared prior to you actually using any jQuery code as seen below :
AjaxjQuery