In a Drupal 7 block, how to enable calling a Javascript function using behaviors
$ isn't defined in the global scope...you either need to use a closure: 

(function($) { 
  // Use $ safely here.
})(jQuery); 


or use jQuery every time 

jQuery("#trial").click(...


If you check the console you should see an error in there to the effect "$ is undefined".