javascript - localStorage item conflicting with other localStorage item -


I am having a problem adding the value to the local storage for other fields if I firstnon poplot I set the price for 2 , but I leave the field blank for Matinee NPS Slot (this should be kept whatever value it was given). After that I will update the changes FirstNumeracy is $ 2.00 as it should be, but Matine NPS Slot is $ NaN . Also, if I set a price for firstnon poplot and the value for the matinapop then there is no Noyen problem.

I do not want it to be optional for any area, it is necessary for all areas without any problem. How do I stop it from happening?

  Function update processing function () {var beforeNoonFieldChange = document.getElementById ('beforeNoonNPSlot'). Values; Var Matinfeld Changer = document.getElementById ('Matinee NPS Slot'). value; LocalStorage.setItem ('Text', change non-field before); LocalStorage.setItem ('text1', Matinefield Challenge); } Load function () {var storedValue = localStorage.getItem ('text'); Var storedValue1 = localStorage.getItem ('text1'); Beforenoonprice = stored value; Matineparic = stored value 1; Before this, follow the CPSLot Pulp HRL = ​​"$" + Parseflot (Stored Value). Tofix (2); $ ("#nonnonprice"). Attr = parseFloat (stored value). Tofix (2); $ ('#Neteworthy'). Attachments ("$" + (Stored Value * 1). Tofix (2)); MatineeCPSlot.innerHTML = "$" + Parceflight (Stored Value1) .toFixed (2); $ ("#matineepiece"). Attr = parseFloat (stored value1) .toFixed (2); $ ('#MATINIPIEES') Attachments ("$" + (Consolidated Value 1 * 1). Tofix (2)); } // javascript document alter agonoonprice = 6.75; // Non-tick var matinetic = change price of 9.00 before; // Change the value of the Matini Ticket varprprice = 9.25; // Change the value of Senior Ticket Virus - 9 2.25; // Change the price of military tickets studentdayprice = 8.00; // Change the price of student day ticket seniordayprice = 6.75; // Senior DayTych Puripropper = 10.75; // Change the price of adult ticket; ==================== // Change the cost of the child ticket; Three rate = 3.50; // Change the price of regular 3D PRICE var imaxprice = 4.50; // imax3dPrice = 5.50 to change the value of iMAX ticket; // Change the price of IMAX 3D ticket = document.getElementById ('Output');  

You are receiving a NaN because you are trying to parse the empty string So either you add a special case to your code, where you check that the string is empty before the formatting is empty (and [not set] or the default in something before), or you have a default value of 0 If set, it can be parsed back and you get $ 0, you can understand Land?


Comments

Popular posts from this blog

java - org.apache.http.ProtocolException: Target host is not specified -

java - Gradle dependencies: compile project by relative path -

ruby on rails - Object doesn't support #inspect when used with .include -