₦airaland Forum

Welcome, Guest: RegisterLoginWith GoogleTrendingRecentNew

Stats: 3,325,060 members, 8,420,090 topics. Date: Thursday, 04 June 2026 at 11:12 AM

Toggle theme

Need Help With This Javascript - Programming - Nairaland

Nairaland ForumScience/TechnologyProgrammingNeed Help With This Javascript (937 Views)

1 Reply (Go Down)

Need Help With This Javascript by exhibit7432(op): 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(op): 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(op): 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:

onclick="addFifty()"

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

id="add".

On your script tag, write this:

<Script>
Var add = document.getElementById("add" ) .value;

function addFifty (){

Var result = add + 50;

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

}

This should work.


</Script>
1 Reply

HELP With This Javascript ProblemCan Someone Help Me With With This Javascript Exercise PleaseHelp Me With This Javascript Problem234

CORONAVIRUS: Real Python Is Giving Away A Free Python Course BundleWhat's The Cost Of Getting And Maintaining E-commerce App For Apple And AndroidBuilding A Tech Startup