I'm having a problem with changing an input's value. The code below works but it's only setting the html value="geolocationvaluehere", the problem is that it doesn't display the text in the input (geolocationvaluehere), it's empty.
I've tried using self.ui.location.val(loc.city)
too but with no success.
View.Form = MyProject.CustomItemView.extend({
template: formTpl,
ui: {
location: 'input[name=location]'
},
onRender: function () {
var self = this;
this.saveLocationToStorage(function(err) {
if( ! err && localStorage.getItem('geoLocation')) {
var loc = JSON.parse(localStorage.getItem('geoLocation'));
if(self.ui.location[0]) self.ui.location.attr('value', loc.city);
}
});
}
});