Posts

Showing posts with the label JavaScript Plugin

Building Your Own JavaScript Plugin

How to Create a Basic Plugin Sometimes you want to make a piece of functionality available throughout your code. For example, perhaps you want a single method you can call on a jQuery selection that performs a series of operations on the selection. In this case, you may want to write a plugin. link How jQuery Works 101: jQuery Object Methods Before we write our own plugins, we must first understand a little about how jQuery works. Take a look at this code: $( "a" ).css( "color" , "red" ); This is some pretty basic jQuery code, but do you know what's happening behind the scenes? Whenever you use the  $ function to select elements, it returns a jQuery object. This object contains all of the methods you've been using ( .css() ,  .click() , etc.) and all of the elements that fit your selector. The jQuery object gets these methods from the  $.fn  object. This object contains all of the jQuery object methods, and if we want to w...

Popular posts from this blog

How to download a file using command prompt (cmd) Windows?

The future of Artificial Intelligence: 6 ways it will impact everyday life

Angular 9 - User Registration and Login Example & Tutorial