Dave
Dave

Reputation: 61

Combine 2 onClick events?

does anyone know how I can combine 2 onclick events?

<a href="#" onClick='return resetVideo("vid1;vid3")'>

I want to reset both videos'1' and '3' - but can't seem to get it to work! Do I have to include the resetVideo command twice?

Thanks!

Upvotes: 0

Views: 7080

Answers (2)

Jayy
Jayy

Reputation: 14728

This should do it:

<a href="#" onClick='resetVideo("vid1"); resetVideo("vid3")'>

Upvotes: 1

Floern
Floern

Reputation: 33904

You can put 'full' JavaScript code into an onclick-Attribute, so you can call multiple Functions:

<a href="#" onClick='resetVideo("vid1");resetVideo("vid3");return false;'>

Note: return false at the end is needed to ignore the href Attribute.

Upvotes: 1

Related Questions