(function($){
function render(jq){
here is the jquery code
}
})(jQuery);
How do I call this render function on the html page?
In (function(){})(); you can call render here, the one that cannot be called outside
is an anonymous function, and the render inside is a local variable, either write your code in it, or move the render function out
<script>
(function($){
$.render = function(jq){
alert("here is jquery code");
}
})(jQuery);
$(function(){
$.render(null);
}) ;
</script>
Follow-up: Your writing method can call the render function. Can I call the render function according to my writing method? Follow-up
:
Yes, although your writing method is a closure , but this closure has nothing to do with the outside world, that is to say, there is no interface provided to the outside world, so it cannot be called!