I have a situation where the Back button on the browser would go back to the previous page, but the input text box is empty, and I checked that the
myControl.options.val()
still has the value. (val is a can.compute())
I can use
var tmpValue = myControl.options.val();
myControl.options.val(tmpValue + " ");
myControl.options.val(tmpValue);
and therefore trigger the change event on val -- by setting it to have one more space and then back to the original value. If I just use myControl.options.val(tmpValue); without adding a space first, then no change event will be triggered because the value stays the same and can.js won't invoke the handler.
And then, can I just trigger the event on val?
Something like
myControl.options.val.trigger("change");
? (and likewise for a can.Observe object).