Call Jquery function

前端 未结 4 1091
一整个雨季
一整个雨季 2021-02-04 06:53

I have a Jquery function like the following

function myFunction(){  
            $.messager.show({  
                title:\'My Title\',  
                msg:\'         


        
4条回答
  •  闹比i
    闹比i (楼主)
    2021-02-04 06:55

    calling a function is simple ..

     myFunction();
    

    so your code will be something like..

     $(function(){
         $('#elementID').click(function(){
             myFuntion();  //this will call your function
        });
     });
    
      $(function(){
         $('#elementID').click( myFuntion );
    
     });
    

    or with some condition

    if(something){
       myFunction();  //this will call your function
    }
    

提交回复
热议问题