I have the following code to reset select menu controls:
// reset menu controls; TODO - need to loop through all categories
$('#btn-reset').live('click', function() {
var myselect = $("select#useOfColor");
myselect[0].selectedIndex = 0;
myselect.selectmenu("refresh");
myselect = $("select#plantVariety");
myselect[0].selectedIndex = 0;
myselect.selectmenu("refresh");
myselect = $("select#design");
myselect[0].selectedIndex = 0;
myselect.selectmenu("refresh");
myselect = $("select#maintenance");
myselect[0].selectedIndex = 0;
myselect.selectmenu("refresh");
myselect = $("select#environmentalStewardship");
myselect[0].selectedIndex = 0;
myselect.selectmenu("refresh");
});
However, this list will only grow. Is there a more elegant method for making sure that all desired select menus in my web page will get cleared without having to add each specific one to this code?
I have similar functions in my app that work just swimmingly. The thing that sets this apart is that I am passing a variable to the function to use as parameter in the WHERE clause of a SELECT.
The function is as follows:
function LoadSite(id) {
if (!window.openDatabase) {
alert('Databases are not supported in this browser.');
return;
}
var selectStatement = 'SELECT * FROM site WHERE id = ?';
console.log('Select me:' + selectStatement);
console.log('Session id:' + id);
// this next section will select all the content from the site table as
The issue is that I am getting an "Uncaught TypeError: Cannot call method 'transaction' of undefined..." (at the line with the ****!!!!**** above, where I have the closure db.transaction(function(transaction)) when the application fires in the console output. I assume that something is wrong with my SELECT statement, but for the life of me, I cannot figure it out. All documentation on use of parameters in SQLite queries are for everything but SELECT, but I figured I could use the syntax of a DELETE with a WHERE clause just as easily.