Welcome, Guest: Join Nairaland / LOGIN! / Trending / Recent / New
Stats: 2,799,154 members, 6,689,120 topics. Date: Monday, 24 January 2022 at 04:06 AM

Need Help With This Javascript - Programming - Nairaland

Nairaland Forum / Science/Technology / Programming / Need Help With This Javascript (720 Views)

Please Help With This Javascript Code / Help Me With This Javascript Problem / Someone Explain This Javascript Snippet (2) (3) (4)

(1) (Reply) (Go Down)

Need Help With This Javascript by exhibit7432(m): 8:01pm On Feb 24, 2020
I need to know how to achieve what’s in the picture. A situation where which when the user clicks on the plus or minus sign or updates the text area.

The amount is incremented 50 times the number in the text area.

Please it’s urgent

Re: Need Help With This Javascript by telad(m): 8:08pm On Feb 24, 2020
your explanation isn't clear enough, if the number is multiplied by 50 when u press the + sign. What happens to the number when u press the - sign?
Re: Need Help With This Javascript by exhibit7432(m): 8:38pm On Feb 24, 2020
When you press the minus sign whatever number there should still be multiplied by 50. To give the total amount.

Each unit costs 50 Naira.

So whichever amount of units that are in the input text box should be multiplied by 50 and displayed there.
Re: Need Help With This Javascript by resosdigital(m): 9:54pm On Feb 24, 2020
Add a click event listener to the button and update the value of the text area withh it's current value * 50.
Re: Need Help With This Javascript by exhibit7432(m): 10:33pm On Feb 24, 2020
Please can you give me the exact code for that. Thank you
Re: Need Help With This Javascript by Karleb(m): 10:45pm On Feb 24, 2020
Let me try.

On the button add click event to it:


On the amount HTML tag, add an id of "add":


On your script tag, write this:

Var add = document.getElementById("add" ) .value;

function addFifty (){

Var result = add + 50;

document.getElementById("add" ) .value = result;


This should work.


1 Like

(1) (Reply)

If You Don't Understand These Memes Then You Are Not A True Programmer / Thank God The Nairaland Initiatives / Does Anyone In Here Know Anything About Php List ?

(Go Up)

Sections: politics (1) business autos (1) jobs (1) career education (1) romance computers phones travel sports fashion health
religion celebs tv-movies music-radio literature webmasters programming techmarket

Links: (1) (2) (3) (4) (5) (6) (7) (8) (9) (10)

Nairaland - Copyright © 2005 - 2022 Oluwaseun Osewa. All rights reserved. See How To Advertise. 64
Disclaimer: Every Nairaland member is solely responsible for anything that he/she posts or uploads on Nairaland.