() { $ (this). Click( function() { alert ((this). Val ());});} ); $ (// on the page: $ ("#input") is a jquery instance, and when it calls the Member method Alertwhileclick, it implements the extension, which pops up the contents of the current editor each time it is clicked.The call to Jquery.extend () does not extend the method to an instance of the object, and the method that ref
Original: http://www.jb51.net/article/42816.htm$.fn refers to the name space of jquery, $.fn=$.prototype.1.$.fn.extendAdd static methods to jquery, similar to $.support,$.each$.extend ({add:function(A, b){returna+function nplugin () {}$.extend ( nplugin.prototype,{add:function(b) {returna+B;}, Plus:function(A, b)
How does JQuery customize plug-ins -- $. fn usage
JQuery provides many plug-ins, which are roughly searched and cannot be described as follows:
I clicked a few and looked at the results. They found that they were quite exquisite. web development needed more aesthetics than Javascript. I can only say that JS is just a foundation.
It is a good news for dev
ArticleDirectory
Starting from
Program
Save as Js for future use
Use him
Starting from
Today, I have a requirement. I have a temporary table for rowspan. The program is ASP. If the operator is handled during table production, the program may be more difficult to handle than the operator. As a result, it is easy to use a jquery FN to do this. Program
The program does not require permi
1 to think of jquery as a class, Jquery.extend () is a static method that extends the class, that is, the extended global function, which is only related to the class itself, regardless of the instantiation object of the specific jquery class.For example: $.each ();2 jquery.fn.extend extension is a method of the jquery prototype object that can be used only by in
(1) How to develop plug-ins:
Jquery.extend (object) is the extension of the jquery class itself, adding new methods to the class.
JQuery.fn.extend (object) Adds a method to a jquery object and adds a member function (Jquery.fn = jquery.prototype) to the jquery class.
(2) Specific wording: an extension of the notation is to call $.ab= ({}) when
Jquery.extend (object); To extend the jquery class itself. Adds a new method to the class.JQuery.fn.extend (object); Adds a method to a jquery object.(function ($) { $.fn.extend ({ Test:function () { Alert ($ (this). attr (' id ')); }})}) (JQuery)$ (' #myDiv '). Test ();Print out: mydiv(function ($) {$.extend ({Test:function () {Alert (' 111 ');}})})
jquery provides a lot of plug-ins, a cursory search, found that there is not a lot to describe:Point a few look, found are quite beautiful, web development needs more is the aesthetic, not JS, can only say that JS is just a foundation bar.It's a developer's gospel. However, so many plug-ins do not always meet our needs, for example, sometimes we just need a ship's engine, now we have only ships, we also need to take apart the ship, or sometimes we nee
The following code immediately follows the introduction of the Jquery.js code———— the above code for the jquery extension ———————— the following to use the extension method ————$ (#id). Click (function () {This means assigning a text box with ID ID "#请输入话题 #" and selecting "Please enter a topic" That is: # Please enter a topic #效果$ (#id). Val (' #请输入话题 # ') myName (1,6);//starting from 1 to sixth (excluding 6th)})
Toggles the visibility of all matching elements by the height change, and optionally triggers a callback function after the switch is complete;This animation effect only adjusts the height of the element, allowing the matching elements to be hidden or displayed in a "swipe" manner. In jquery 1.3, the upper and lower padding and margin will also be animated, with smoother resultsInstance:[jquery effect Slide
Filters out the collection of elements that match the specified expression, which is used to narrow the matching range, separating multiple expressions with commasWhen a parameter is a function, the parameters inside the function are interpreted as follows:A function is used as a collection of test elements. It accepts a parameter index, which is an element in the jquery collection. In the function, this refers to the current DOM elementExample: The
Currently support click, DblClick, MouseDown, MouseUp, MouseMove, MouseOver, Mouseout, KeyDown, KeyPress, KeyUp.
Also does not support blur, Focus, MouseEnter, MouseLeave, change, submit
Unlike bind (), Live () can only bind one event at a time.
This approach is similar to traditional bind, except that using live to bind events gives all current and future elements of the page a binding event (using delegated methods). For example, if you bind the click event to all the Li on the page with live.
This method is used to replace all matching elements with the specified HTML or DOM elementsContent (String, Element, JQuery, Function)The content that is used to replace the matching element. If a function is passed in here, the function return value must be an HTML string.FnReturns the THML string that is used to replace the content.Instance: Thisis unwrap test Thisis unwrap test[jquery document Processin
When the DOM is loaded and can be queried and manipulated, bind a function to be executed. The following is an example. If you do not know it, you can learn it. 1. Event introduction.
(1) bind a function to be executed when the DOM is loaded and can be queried and manipulated;
(2) Make sure thatThe onload event of the element does not register a function; otherwise, the + $ (document). ready () event is not triggered;
(3) The $ (document). ready () event can be used infinitely on the same page;
Get the current value of the matching element, often applied to form elements, select ...., readable and writableInstance:[jquery Method Val ([Val|fn|arr])] This method obtains the current value of the matching element, often applied to form elements, select ....
This method is used to achieve fading of all matched elements by adjusting the opacity to the specified target, and optionally triggering a callback function after the animation is completeInstance:[jquery effect FadeTo ([SPEED,[EASING],[FN])] This method is used to fade all matched elements by adjusting the opacity to the specified target, and optionally triggering a callback function after the animation i
Gets the HTML content of the first matching element, which cannot be used in an XML document, but can be used in an XHTML document, and in an HTML document we can use the. html () method to get the contents of any element. If the selector matches more than one element, only the HTML content of the first matching element is fetched, equivalent to the innerHTML in JavaScript, readable and writable, and HTML tags can be parsedIf callback is passed in, this function returns a string and the paramete
A function used to return the name of the style class to toggle on each element in the matching element collection:If the second argument is callback, then the class name needs to be returned, and the function arguments are interpreted as follows:1: Receive element's index position and element old style class as parameter2: A Boolean value to determine whether the style class is added or removed3. Boolean value to determine if the element contains Class (Sw[switch])Instance:[
Get the contents of all matching elements: The result is text that is combined with the text content contained by all matching elements, which is valid for both HTML and XML documents, equivalent to the innertext attribute in JavaScript, readable and writable, but unable to parse the HTML tag:If callback is passed in, this function returns a string and the parameters are resolved as follows:1.index is the index position of the element in the collection2.text is the original text value.Instance:[
This method is used to wrap all matching elements in a structured tag of other elementsInstance: Thisis unwrap test[JQuery document processing Wrap (HTML|ELEMENT|FN)] This method is used to wrap all matching elements in a structured tag of other elements
The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion;
products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the
content of the page makes you feel confusing, please write us an email, we will handle the problem
within 5 days after receiving your email.
If you find any instances of plagiarism from the community, please send an email to:
info-contact@alibabacloud.com
and provide relevant evidence. A staff member will contact you within 5 working days.