I guess what I want to do is grab all the parameters of the showIt
function on the onclick event (see below) and bind a click event to
each matched <div> with the parameters just grabbed.

See html code below...

---------------
<html>
<head>
  <script src="http://code.jquery.com/jquery-latest.js";></script>

  <script>
  $(document).ready(function(){
                $("div.h1").each(function() {
                        otherFunction.apply(null, $
(this).find("a:first").attr("onclick").makeArray(arguments));
                });

  });

        function showIt() {
        alert('First argument: ' + arguments[0]);
        }

        function otherFunction() {
        alert('2nd argument: ' + arguments[1]);
        }

  </script>

</head>
<body>
        <div class="h1">
        <a href="" onClick="showIt('first','second','third');">Click me</
a><br>
        <a href="" onClick="otherFunction();">Other function Click me</a>
        </div>
</body>
</html>

Reply via email to