-1

I have two JQuery funciont and i need to start one of them in one function. This is my example:

<script type="text/javascript">
$(document).ready(function aa() {...... })
</script>

And i want to call this function in another:

<script type="text/javascript">
  function hello(){
    aa();
  }
</script>
Frank
  • 730
  • 2
  • 9
  • 20
  • It's like looking for a needle in a haystack :D Please clean up your code, try to expose only the most interesting bits and find a good balance between code and explanations. –  Dec 01 '13 at 10:54
  • -1 because I didn't understand the title, and after reading the question, I still don't understand the title nor the question. – Hubro Dec 01 '13 at 10:55
  • I edited my question! now isn't -1 ;) – Frank Dec 01 '13 at 10:58
  • good on you for tidying it up, thanks – actual_kangaroo Dec 01 '13 at 10:58

2 Answers2

1

Need a tiny bit of restructuring to move aa out of $(document).ready at top of your code so you can use it elsewhere also

/* call aa as ready handler*/
$(document).ready(aa);
/* aa now global*/
function aa() {
    $('#catAssociate tbody tr').contextMenu('myMenu2', {
        bindings: {
            'open': function (t) {
                console.log("chiamo ioooo");
                DeleteAction(t, "Open");
            },
        }
    });
}
charlietfl
  • 170,828
  • 13
  • 121
  • 150
0

aa is unaccessible because you defined it within $(document).ready, try putting it in global scope

function aa() {
   ...
}

$(document).ready(aa);

and in your other script you can call it as such

 function hello(){
   aa();
 }
Community
  • 1
  • 1
actual_kangaroo
  • 5,971
  • 2
  • 31
  • 45