Hey guys can anyone spot what I did wrong in this code. I'm tryna create a table.

Code:
	$("#confirmdate").click(function()
					{
						
var datename = $("#adddatename").val();
var datenamelen = $("#adddatenameval().length;
var datestory = $("#datestory").val();
var timedate = $("#addtimedate").val();
var datelocation = $("#addlocationdate").val();
var created = $.now();	
				if(datenamelen >= 4){
				function populateDB(tx){
					tx.executeSql('CREATE TABLE IF NOT EXISTS newdate(id INTEGER NOT NULL PRIMARY KEY AUTOINCREMENT, created unique, datename, datestory, timedate DATETIME, datelocation)');
							tx.executeSql('INSERT INTO newdate(created, datename, datestory, timedate, datelocation) VALUES(?, ?, ?, ?)', [created, datename, datestory, timedate, datelocation]);
					}
					function errorCB(err){
						alert("Failed to add new date");
					}
					function successCB(){
					alert("You have succesfully added a new date");
					}
					var db = openDatabase('To Do', '1.0', 'To Do', 2 * 1024 * 1024);
					db.transaction(populateDB,errorCB,successCB);
			
					}else{
					alert("Minimum of 4 characters required");
						}
					});