 <p>Both of these would work:</p> <pre><code>$("#animation1, #animation2, #animation3").click(function() { // existing code }); </code></pre> <p>or </p> <pre><code>function animate() { //existing code } $("#animation1").click(animate); </code></pre>