//declare the function outside the ready() function function YourFunctionName() { //your code } $(document).ready(function(){ // Other code });