The jquery Wrapper provides a number of methods that can be used directly from the page. However, no
Any library can meet all the requirements, so the jquery library offers rich extensibility features
。 To disable a set of form elements as an example, see how to easily and effectively add custom in the jquery library
Extension of the function. (jquery does not have a way to disable form elements OH)
On the code:
1: <! Doctype> 2:
Text boxes and buttons have been disabled:
If you disable the button only, add a CSS class;
1:jquery (function () 2: { 3: $ ("Form Input.test"). disable (); 4: });
See if the button is disabled:
Implementation is also very simple, open Jquery-2.1.1.js source code, no compression, easier, I introduced
Is Jquery-2.1.1.js, then add the following code
1:jquery.fn.disable=function () { 2: return This.each (function () 3: { 4: if ( this.disabled = null) this.disabled=true; 5: }); 6: }
You can call it in the same way as the above case.
In the book "JQuery in Action", we refer to the extension of $.fn . Method name (P12), I
Tested, no implementation disabled. Error, but also look at the correct.
More related articles, go to see
Extending the implementation of custom methods in jquery