0

is it possible to call three buttons using one function on JavaScript?

If i enter a number then click the price button i want to display the transaction below and substract it to the balance. is it possible using JavaScript only?

10th Nov 2018, 8:58 AM
Bry
Bry - avatar
5 Respostas
+ 1
ok, set global variable to 100, create a div element, create input text element, then create an ordered list and set an id. Create events to each button, now go to js, create a variable linked to input id, set onchange event on input element and assign a event.target.value to a variable lets say userInput. everytime user input something and hit on of the buttons, set an ordered list variable by id and dinamically create a list element, then write info into it using .innerHTML . Thats it :D
10th Nov 2018, 5:38 PM
Sokrat_Poghosyan
Sokrat_Poghosyan - avatar
+ 1
As I understand saying calling button you mean calling a paired event function with that button, if so the answer is yes, you can call functions as much as you want ). Javascript is very powerfull language, you can even write desctop applications using js, for example Slack, skype, etc...
10th Nov 2018, 9:15 AM
Sokrat_Poghosyan
Sokrat_Poghosyan - avatar
+ 1
explain exactly what you want to do, I’ll say how.
10th Nov 2018, 4:33 PM
Sokrat_Poghosyan
Sokrat_Poghosyan - avatar
0
what i want to achieve is something like a loading station. here is my sample code. https://code.sololearn.com/WoNK4ub2f6lP/?ref=app
10th Nov 2018, 4:30 PM
Bry
Bry - avatar
0
current balance = 100 1 input and 3 buttons let say x = 10 y = 20 z = 30 when i input a cell number and click x. it will display 190. until my balance become insufficient and then it will alert the user. and at the bottom it will display " '10 is send to' + input"
10th Nov 2018, 5:13 PM
Bry
Bry - avatar