I provide a textarea on an HTML page. A button saves it successfully to the database with a confirming alert. However, when returning to the textarea page, I want the DB to automatically populate the textarea, and this is part of the coding is not working - textarea is blank.

Google Tools reports a "object SQLError" when the page loads, and the reference line is the error function. Google Tools shows the DB properly populated with the entered content.

I'd appreciate a new pair of eyes to point me to a new direction to get the textarea to populate on pageload.

Code:
// Wait for Cordova to load
function onLoad() {
document.addEventListener("deviceready", onDeviceReady, false);
	onDeviceReady();
}

var db;

function onDeviceReady() {
db = window.openDatabase("Database", "1.0", "BOOKMARKS6", 200000);
db.transaction(populateDB, errorCB, successCB);
}

// Create the database

function populateDB(tx) {
tx.executeSql('CREATE TABLE IF NOT EXISTS BOOKMARKS6 (id TEXT NOT NULL, type TEXT NULL, filename TEXT NOT NULL, title TEXT NOT NULL)');
}

// 1. Transaction error callback (corrected per Sitepoint.com post)

function errorCB(tx, err) {
   console.log('Error processing SQL (function errorCB): ' + err);
}

// 2. Transaction success callback

function successCB() {
var db = window.openDatabase("Database", "1.0", "BOOKMARKS6", 200000);
db.transaction(queryDB, errorCB);
}

function errorCB(tx, err) {
   console.log('Error processing SQL (function errorCB): ' + err);
}

// 4. Display the row on this page (onLoad)

function querySuccess(tx, results) {
	document.getElementById("userNote").value = results.rows.type;
}

// 5. Query the DB
var doc = document.title;
function queryDB(tx) {
tx.executeSql("SELECT * FROM BOOKMARKS6 WHERE type != 'B' AND id == doc", [], querySuccess, errorCB);
}

function persistNote() {
db = window.openDatabase("Database", "1.0", "BOOKMARKS6", 200000);
db.transaction(function(tx) {
	var type = document.getElementById("userNote").value;
	var id = document.title, filename = window.location.pathname, title = document.title;
	tx.executeSql("insert into BOOKMARKS6(id, type, filename, title) values(?,?,?,?)", [id, type, filename, title]);
	}, errorCB, successCB()); alert('Note added.');
}