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?
5 odpowiedzi
+ 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
+ 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...
+ 1
explain exactly what you want to do, I’ll say how.
0
what i want to achieve is something like a loading station. here is my sample code. https://code.sololearn.com/WoNK4ub2f6lP/?ref=app
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"