```
        val = val || currentVal;
```
When first loaded the page and open the dialog `val` was undefined.