title: How can I insert variable values into my database in SQLite?
body: <p>I've somehow managed to insert the contents of a text field using the text fields id with the following code but would rather assign whatever is in the text field to a variable and then insert the value of that variable.</p>
  
  <pre><code>var newName = document.getElementById("txNewName").value;
  var ing1 = document.getElementById("txIngredient1").value;
  var ing2 = document.getElementById("txIngredient2").value;
  var ing3 = document.getElementById("txIngredient3").value;
  
  db.transaction(function(transaction) {
      transaction.executeSql('INSERT INTO MyRecipes(MyRecipeName, MyIngredient1, MyIngredient2, MyIngredient3) VALUES (?,?,?,?)',[$('#txNewName').val(), $('#txIngredient1').val(), $('#txIngredient2').val(), $('#txIngredient3').val()]);
  });
  </code></pre>
  
  <p>I'm using SQLite if that makes a difference and am very new to it so would appreciate any help. </p>