"Unexpected end of input" error

I’m getting this error from the following code and can’t figure out where the missing closing element is. This is the only code on the page:

function setItemForm1b() {
    var form1b = document.getElementById('form1b'),
        SOneDateFrom = document.getElementById('SOneDateFrom');
    localStorage.setItem('SOneDateFrom', JSON.stringify(SOneDateFrom.value));
"Unexpected end of input" usually means a closing element is missing.
function getItemForm1b() {
    var SOneDateFrom = localStorage.getItem('SOneDateFrom');
    form1b.SOneDateFrom.value = JSON.parse(SOneDateFrom);

function deleteStorage() {
    form1b.SOneDateFrom.value = localStorage.setItem('SOneDateFrom','');
    if (form1b.SOneDateFrom.value === "undefined") {
        form1b.SOneDateFrom.value = "";

Does “Unexpected end of input” indicate a different kind of problem at times?

The JSON parser returns that error when it cannot make a properly formatted JSON string from the input, and when it fails to create an object with JSON.parse.

Strange … all I entered was 123

Thanks. What should I do differently?

Try including quotes, but if your values are strings, why are you using JSON at all?

I probably misunderstood the instructions when I was creating the pages!

I notice that without JSON, quotes are inserted around the string when read back into the field. Yuck.

My test page, with all code on one page, worked fine. Now on separate pages, it refuses to work.