How can I call a jQuery function from JavaScript?
//jQuery
$(function() {
function my_func(){
/.. some operations ../
}
});
//JavaScript
function js_func () {
my_func(); //== call JQuery function
}
$(function() {
function my_func(){
/.. some operations ../
}
})
runs the everything inside when the page is "ready".
You don't need that.
Just define the function list this
function my_func(){
/.. some operations ../
}
P.S. "How can i call a jQuery function from JavaScript?" is a bad question. jQuery is a library written using Javascript.
You can do it by actually changing the declaration to outside jQuery callback, but if you have some specific purpose following will work for you
$(function() {
window.my_func = function() {
/.. some operations ../
}
});
//JavaScript
function js_func () {
my_func(); //== call JQuery function
}
jQueryisJavaScriptlibrary, what you are asking ?