I'll start with the problem :
(notice : the stringify
representation of the object - Always shows the correct values)
And here are the Details:
I select a street
in the textbox
(it should set the StreetText
value in the object)
I look at the console
(wide line) and press the last line , looking at the street text.
At first it's OK. In the second try, after I choose another street, it stays on the old value.
However, when I press refresh (on the object), it shows me the correct street name.
What is going on here?
My object is a regular object literal :
var obj =
{
getData: function ()
{
obj.CountryId = $(".ddlCountry").val() || "";
obj.CountryText = $(".ddlCountry :selected").text() || "";
obj.StateId = $(".ddlState:visible").val() || "";
obj.StateText = $(".ddlState:visible :selected").text() || "";
obj.CityId = $(".hfDataIdCity").val() || "";
obj.CityText = $(".hfDataTextCity").val() || "";
obj.StreetId = $(".hfDataIdStreet").val() || "";
obj.StreetText = $(".hfDataTextStreet").val() || "";
}
}
and the display on the console is made by onclicking the button :
obj.getData();
console.log(obj);
Why I'm not seeing the correct values ? ( only after refresh....)
p.s. :
ff: 14.0.1
fb:1.10.6
and the cache is turned off
Use console.dir(obj) for objects not console.log(obj), you are getting a string of the object by doing that so updating it will still work in your code but not show in the console. Strings are immutable, so no property update wil show in your console. Tip: Use watch expressions in chrome debugger.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With