TL;DR getTotal should give me a total of these 2 functions summed together but it’s throwing me an error instead: Uncaught ReferenceError: getTotal is not defined onchange http://127.0.0.1:3211/XyZPage/Untitled-1.html:1 Uncaught ReferenceError: getTotal is not defined onclick http://127.0.0.1:3211/XyZPa…
Tag: javascript
Luxon fromFormat pattern ignore time
When I try to create Date object from string format in Luxon I get invalid date. Hours and minutes are not passed. This gives me an Invalid date Using moment library it seems that if hours and minutes are not passed it defaults to 00:00:00 Is there some option to format both formats with hours and without in …
Javascript: How to compare against substring in PDF forms?
I am trying to use some Javascript in a PDF form. As an example, let’s say I have two fields: let’s call them TextField1 and TextField2. These fields can be used independently, but when TextField1 has a certain value, I’d like TextField2 prefilled. This works fine (triggered onBlur, not that…
React Tailwind Dynamic Div Height Not Updating Post Calculation
I have a screen which has two divs: top navbar (80px in height) and a div component below the navbar (remaining screen height). Since I am using tailwind formatting looks something like this: The problem, navbar is 80px and bottom content is dynamic but a white gap appears at the bottom. White gap will disapp…
How can I transform this object with strings into a normal one?
I have the following object: I expect it to be: The code I am currently running: The error I’m getting: How can I solve it? Answer o[p] or the user is undefined initially. So, when you try to set name property of the user object, it will throw an error. You can use the Logical nullish assignment to set …
Multiple conditions/operators to show/hide html elements in React (NextJS)
I’m looking to display some html in my React/Next.js web app based on conditional logic. I got the basics working but having issues showing the same html if multiple variable conditions are true. For example, the following code works fine. I’m having issues showing multiple variables as true. The …
How to get the value of iterating object? Without using foreach and dot operator
For example: I need answers like: My name is David, I’m 30 years old. I earned monthly 30000. Note: Without using ‘.’ DOT operator and for and foreach. Answer var myObject = { name : ‘David’, age: ’30’, salary:’30000′ } //object destructure let {name, age,…
Showing button after keydown event
I want to show 2 buttons when keydown event is triggered. It’s actually for profile page where when any data is edited Then only update or cancel button should appear.but by default these buttons should be not seen.I used js to show the button or trigger a css class whenever the keydown event is trigger…
JavaScript – Child objects called by functions to update child objects
I am learning about objects and their scopes, I got confused and decided to make a D&D pathfinder character sheet for practice. I made the character sheet as an object, child objects for ability scores, strength/dexterity/intelligence/etc… and then base and modifier values. in D&D you use your b…
getting textarea value with newlines javascript
I have an HTML textarea and when data entered, and when submitted a js function takes values form textarea and puts them into a paragraph. but there is newline between textarea values and when the function takes those values it puts them without newlines in the paragraph. Is there any way to make newlines eve…