call user defined function in jquery

Posted by pritisolanki on Stack Overflow See other posts from Stack Overflow or by pritisolanki
Published on 2010-03-25T23:27:15Z Indexed on 2010/03/25 23:33 UTC
Read the original article Hit count: 354

Filed under:
|
|

Hi,

I am trying to call user defined function in jquery.

$(document).ready(function() {
 $('#btnSun').click(function(){
  myFunction();
 });
 $.fn.myFunction = function() { 
     alert('hi'); 
 }
});

I tried following as well

function myFunction()
{
alert('hi');
}

but it doesn't seems to work !! Any idea where I am wrong?

Regards, Priti

© Stack Overflow or respective owner

Related posts about jQuery

Related posts about user-defined