$(document).ready(function(){ $('#add').on('click',function(){ alert(aaa); }) }) code example
Example: document ready
// A $( document ).ready() block.
$( document ).ready(function() {
console.log( "ready!" );
});
// A $( document ).ready() block.
$( document ).ready(function() {
console.log( "ready!" );
});