I saw a post out there:
However I still don’t understand it. Can someone explain this in very simple terms to me. Why did they choose to specify it this way?
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
$.fnis just an alias forjQuery.prototype. To write a jQuery plugin, such as DataTables, one usually starts by adding a new function property to$.fn.In simpler terms, when you write
$.fn.pluginName, you are extending jQuery’s prototype, by adding a new function calledpluginNameto it. This way, you can call it using, for example,$("#myElement").pluginName(). That’s basically what DataTables does, it provides an extension to jQuery calleddataTablesExt.Now, this plugin has several properties. One of them, is called
afnSortData(which you could also refer to usingjQuery.prototype.dataTableExt.afnSortData). This way, the plugin properties are scoped to thedataTableExtobject/plugin. DataTables could have opted to define it in the global namespace, but this way, someone could overwriteafnSortDatawith, say,{}and break the plugin.