copy events from one elm to other using jquery
<pre><code>    ==dom is like this==

   &lt;a href='javascript:void(0)' id='link1'&gt;elm with  events bound initially&lt;/a&gt;
   &lt;a href='javascript:void(0)' id='link2'&gt;elm to which events are bound in future&lt;/a&gt;

    ====js==
    $(function(){
    $('#link1').bind('click',function(){alert('do something to make me happy');})
    });

    //now some time in future i want to copy all events bound on link1 to link2

//iam doing it as written below
// please suggest some better way if possible or available


        var _elmEvents = $(#link1).data('events');

        if (_elmEvents) {
           $.each(_elmEvents, function (event, handlers) {
             $.each(handlers, function (j, handler) {
                 $('#link2').bind(event, handler);
             });
           });
        }
</code></pre>
