开发者

How to call jQuery function from normal JS function?

How to call jQuery function from normal JS function? ( A + B Sample needed)

So I need a jQuery function adding varA to varB. And a JS function which could call that jQuery function sending 开发者_如何学JAVAvarA and varB to It and reciving result.


jQuery functions are normal javascript: jQuery is just a file that includes a bunch of extremely well-written and useful javascript functions.

You can view the (100% javascript) source for the latest release here.


jQuery functions are normal javascript functions.

So, you just call it like a "normal" function like in the following example using jQuery's trim().

    function isStringEmpty(str){
                             // jquery function
        return str!==null && jQuery.trim(str).length > 0;
    }
    alert(isStringNullorEmpty("hello")); //alerts false
    alert(isStringNullorEmpty("")); //alerts true


A jQuery function is a normal JavaScript function.

 function myFunction () {
     function_name(); // and / or
     object.property_name();
 }

 myFunction();
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜