Posts

Showing posts with the label difference in two.

jQuery: $.fn.extend() and $.extend()

jQuery: $.fn.extend() and $.extend()  There is a significant difference between using $.fn.extend()   and $.extend() Extend jQuery for DOM Tags. When you want to create your own method of your DOM Tag, i.e. $(element).yourfunctionname(); $(#MyCheckBox).Check(); To achieve this, you have to define: $.fn.yourfunctionname = function () {     var o = $( this [0]) // It's your element }; $.fn.extend({      Check: function (){           Return this .each( function () { this .checked = true }); } }); We can extend multiple functions in a single “$.fn.extend” block. $.fn.extend({      Check: function (){           Return this .each( function () { this .checked = true }); },      UnCheck: function (){          ...