bil80
bil80

Reputation: 41

Calling two onclick functions

I have a submit button with onclick="return loadSubmit()" and i want to hide it after clicking with this this.style.visibility = "hidden";

i tried to make these two functions in the same button

<input type="image" name="Generate" class="contSubmit" src="generate.png" onclick='return loadSubmit();this.style.visibility = "hidden";'  />

but this does not work, what's the solution please?

Thanks

Upvotes: 0

Views: 1940

Answers (2)

Quentin
Quentin

Reputation: 944545

Since you are going to change the visibility no matter what the result of loadSubmit is, just swap the statements around so the return statement is last.

onclick='this.style.visibility = "hidden";return loadSubmit();'

Upvotes: 1

Andreas Wong
Andreas Wong

Reputation: 60594

Just swap them order

 onclick='this.style.visibility = "hidden"; return loadSubmit();'

Upvotes: 4

Related Questions