user3826281
user3826281

Reputation: 1

Running two javascript functions in one button click in jade

I have my html set up and my javascript functions ready but I can't get it to run both at the same time only one runs once I click the button. I'm using the Jade template engine with Node.js and this is what I have so far:

input(type = 'button' value = 'Calcular' onClick = "calculateComission()""calcMonthlyPay()")

Upvotes: 0

Views: 989

Answers (3)

Shang
Shang

Reputation: 75

input(type = 'button' value = 'Calcular' onClick = "calculateComission();calcMonthlyPay()")

Does this work?

Upvotes: 0

Mallen
Mallen

Reputation: 262

onClick="calculateComission();calcMonthlyPay();"

But this is pretty bad. You usually don't want to bind functions inline like that, especially for more complex logic like this. You should probably make a function that calls the other two and bind that, or better bind the event listener in code on page load.

Upvotes: 0

David Pullar
David Pullar

Reputation: 706

function bothFunctions() {
   calculateComission()
   calcMonthlyPay()
}

input(type='button' value='Calcular' onClick="bothFunctions()")

Upvotes: 6

Related Questions