Swimming V2

Yes or No confirm box using jQuery

by m4xout

HTML

<script src="//code.jquery.com/jquery-1.10.2.js"></script>
<script src="//code.jquery.com/ui/1.10.4/jquery-ui.js"></script>
<link rel="stylesheet" href="//code.jquery.com/ui/1.10.4/themes/smoothness/jquery-ui.css">

JavaScript

var $dialog = $('<div></div>');

function popup() {
	var title = "Question";
	var html = "Would you like to go swimming?";
	$dialog.html(html);
	$dialog.dialog({
		title: title,
		resizable: false,
		buttons: {
			" Yes ": function() {
				$( this ).dialog( "close" );
				yes_function();
			},
			" No ": function() {
				$( this ).dialog( "close" );
				no_function();
			}
		}
	});
}
popup();
function yes_function() {
    alert('You have chosen to go swimming');
    go_swimming();
    
}



function no_function() {
    alert('No');
   
}

function go_swimming() {
alert('Things to remember when you go swimming are:')
alert('1. Push yourself further than is comfortable for most benefits. You can go on more than what you think. Continually do this and you will improve more and more.')
}