How to Call jQuery function from JavaScript with example

I have heard many times people saying that I need to call jQuery function from JavaScript. I told them there is no special technique to do that. Just put your fingers on your keyboard and start coding as you normally do. You will get to know that it’s very much easy. But now its really became a wanted question to me. Because so many people asked me this question during the last few months.

So here in this JavaScript tutorial, I will show you calling jQuery function from JavaScript with an example.

You may also interested in,

Add and remove class dynamically to an element using jQuery

Real Time Chat Application PHP With File Transfer System AJAX

Why use javascript:void(0) in hyperlinks?

Call jQuery function from JavaScript

the shortest way to declare a jQuery function is:

// Your code goes here

Now assume that you have a JavaScript function named: my_js_function()

Now you have to call a jQuery function from this my_js_function()

In order to access a jQUery function from a JavaScript function, you can declare a variable and assign it to a jQuery function. Finally, just call it from a JavaScript function.

var my_jquery_function;
// this is jQuery function
    my_jquery_function = function( _text )
        alert( _text );
// This is javascript function
function my_js_function()
    //Invoke jQuery Function
    my_jquery_function("I am called from a JavaScript Function");

In this way you can call a jQuery function from JavaScript.

How to run multiple JavaScript functions onclick

Get user’s Latitude and Longitude in JavaScript – HTML5 Geolocation


Leave a Reply

Your email address will not be published. Required fields are marked *