If
your external js method is not called then there should be 2 problems. 
Problem
1 
It
looks like jquery.js contains the code you wrote that depends on jQuery.
Solution:
You
need to load jQuery before your external js file.
Problem
2
 User defined function
is not in $(function() { 
/* your function */ 
});
$(document).ready() function. Everything
inside it will load as soon as the DOM is loaded and before the page contents
are loaded.
 $(document).ready(function()
{
   // some code here
 });
$(document).ready(function()
{
   // other code here
 });
 $(document).ready(), 
you can write $(function(){ ... }) instead, like so: 
  $(function() {
   // do something on document ready
 });
Solution:
Add the below code. 
$(function ()  
{ 
 /* your function
*/ 
});
For more Ref: jquery doc 
No comments :
Post a Comment