/    Sign up×
Community /Pin to ProfileBookmark

multiple events with on click=?

Hopefully this is an easy one. I would like to know if multiple events can be assigned to an on click. If I have ‘on click=”submit”‘ at the end of a form, can I also have that same click execute a javascript function?
Thank you for your time!

GMan

to post a comment
JavaScript

3 Comments(s)

Copy linkTweet thisAlerts:
@A1ien51Jan 25.2006 — onclick="function1();function2();function3();"

Eric
Copy linkTweet thisAlerts:
@SelrachJan 25.2006 — sure...give it multiple statements:
[CODE]<div onclick="validate(); submit();">Click Me</div>[/CODE]
Even better, put everything you want to do in one function and call that.
Copy linkTweet thisAlerts:
@KorJan 25.2006 — sure...give it multiple statements:
[CODE]<div onclick="validate(); [COLOR=Red]submit()[/COLOR];">Click Me</div>[/CODE]
Even better, put everything you want to do in one function and call that.[/QUOTE]

Try avoid giving functions reserved javascript words as name. [B]submit()[/B] is a javascript method, so that using this name as function can create problems.
×

Success!

Help @bubba4gman spread the word by sharing this article on Twitter...

Tweet This
Sign in
Forgot password?
Sign in with TwitchSign in with GithubCreate Account
about: ({
version: 0.1.9 BETA 6.2,
whats_new: community page,
up_next: more Davinci•003 tasks,
coming_soon: events calendar,
social: @webDeveloperHQ
});

legal: ({
terms: of use,
privacy: policy
});
changelog: (
version: 0.1.9,
notes: added community page

version: 0.1.8,
notes: added Davinci•003

version: 0.1.7,
notes: upvote answers to bounties

version: 0.1.6,
notes: article editor refresh
)...
recent_tips: (
tipper: @meenaratha,
tipped: article
amount: 1000 SATS,

tipper: @meenaratha,
tipped: article
amount: 1000 SATS,

tipper: @AriseFacilitySolutions09,
tipped: article
amount: 1000 SATS,
)...