UNPKG

387 kBTypeScriptView Raw
1// tslint:disable:jsdoc-format
2// tslint:disable:max-line-length
3// tslint:disable:no-irregular-whitespace
4
5interface JQuery<TElement = HTMLElement> extends Iterable<TElement> {
6 /**
7 * A string containing the jQuery version number.
8 * @see \`{@link https://api.jquery.com/jquery-2/#jquery1 }\`
9 * @since 1.0
10 * @example ​ ````Determine if an object is a jQuery object
11```javascript
12var a = { what: "A regular JS object" },
13 b = $( "body" );
14
15if ( a.jquery ) { // Falsy, since it's undefined
16 alert( "a is a jQuery object!" );
17}
18
19if ( b.jquery ) { // Truthy, since it's a string
20 alert( "b is a jQuery object!" );
21}
22```
23 * @example ​ ````Get the current version of jQuery running on the page
24```javascript
25alert( "You are running jQuery version: " + $.fn.jquery );
26```
27 */
28 jquery: string;
29 /**
30 * The number of elements in the jQuery object.
31 * @see \`{@link https://api.jquery.com/length/ }\`
32 * @since 1.0
33 * @example ​ ````Count the divs. Click to add more.
34```html
35<!doctype html>
36<html lang="en">
37<head>
38 <meta charset="utf-8">
39 <title>length demo</title>
40 <style>
41 body {
42 cursor: pointer;
43 }
44 div {
45 width: 50px;
46 height: 30px;
47 margin: 5px;
48 float: left;
49 background: green;
50 }
51 span {
52 color: red;
53 }
54 </style>
55 <script src="https://code.jquery.com/jquery-3.3.1.js"></script>
56</head>
57<body>
58​<span></span>
59 <div></div>​
60<script>
61$( document.body )
62 .click(function() {
63 $( document.body ).append( $( "<div>" ) );
64 var n = $( "div" ).length;
65 $( "span" ).text( "There are " + n + " divs." +
66 "Click to add more.");
67 })
68 // Trigger the click to start
69 .trigger( "click" );
70</script>
71
72</body>
73</html>
74```
75 */
76 length: number;
77 /**
78 * Create a new jQuery object with elements added to the set of matched elements.
79 * @param selector A string representing a selector expression to find additional elements to add to the set of matched elements.
80 * @param context The point in the document at which the selector should begin matching; similar to the context
81 * argument of the $(selector, context) method.
82 * @see \`{@link https://api.jquery.com/add/ }\`
83 * @since 1.4
84 */
85 add(selector: JQuery.Selector, context: Element): this;
86 // TODO: The return type should reflect newly selected types.
87 /**
88 * Create a new jQuery object with elements added to the set of matched elements.
89 * @param selector_elements_html_selection _&#x40;param_ `selector_elements_html_selection`
90 * <br>
91 * * `selector` — A string representing a selector expression to find additional elements to add to the set of matched elements. <br>
92 * * `elements` — One or more elements to add to the set of matched elements. <br>
93 * * `html` — An HTML fragment to add to the set of matched elements. <br>
94 * * `selection` — An existing jQuery object to add to the set of matched elements.
95 * @see \`{@link https://api.jquery.com/add/ }\`
96 * @since 1.0
97 * @since 1.3.2
98 * @example ​ ````Finds all divs and makes a border. Then adds all paragraphs to the jQuery object to set their backgrounds yellow.
99```html
100<!doctype html>
101<html lang="en">
102<head>
103 <meta charset="utf-8">
104 <title>add demo</title>
105 <style>
106 div {
107 width: 60px;
108 height: 60px;
109 margin: 10px;
110 float: left;
111 }
112 p {
113 clear: left;
114 font-weight: bold;
115 font-size: 16px;
116 color: blue;
117 margin: 0 10px;
118 padding: 2px;
119 }
120 </style>
121 <script src="https://code.jquery.com/jquery-3.3.1.js"></script>
122</head>
123<body>
124
125<div></div>
126<div></div>
127<div></div>
128<div></div>
129<div></div>
130<div></div>
131
132<p>Added this... (notice no border)</p>
133
134<script>
135$( "div" ).css( "border", "2px solid red" )
136 .add( "p" )
137 .css( "background", "yellow" );
138</script>
139
140</body>
141</html>
142```
143 * @example ​ ````Adds more elements, matched by the given expression, to the set of matched elements.
144```html
145<!doctype html>
146<html lang="en">
147<head>
148 <meta charset="utf-8">
149 <title>add demo</title>
150 <script src="https://code.jquery.com/jquery-3.3.1.js"></script>
151</head>
152<body>
153
154<p>Hello</p>
155<span>Hello Again</span>
156
157<script>
158$( "p" ).add( "span" ).css( "background", "yellow" );
159</script>
160
161</body>
162</html>
163```
164 * @example ​ ````Adds more elements, created on the fly, to the set of matched elements.
165```html
166<!doctype html>
167<html lang="en">
168<head>
169 <meta charset="utf-8">
170 <title>add demo</title>
171 <script src="https://code.jquery.com/jquery-3.3.1.js"></script>
172</head>
173<body>
174
175<p>Hello</p>
176
177<script>
178$( "p" ).clone().add( "<span>Again</span>" ).appendTo( document.body );
179</script>
180
181</body>
182</html>
183```
184 * @example ​ ````Adds one or more Elements to the set of matched elements.
185```html
186<!doctype html>
187<html lang="en">
188<head>
189 <meta charset="utf-8">
190 <title>add demo</title>
191 <script src="https://code.jquery.com/jquery-3.3.1.js"></script>
192</head>
193<body>
194
195<p>Hello</p>
196<span id="a">Hello Again</span>
197
198<script>
199$( "p" ).add( document.getElementById( "a" ) ).css( "background", "yellow" );
200</script>
201
202</body>
203</html>
204```
205 * @example ​ ````Demonstrates how to add (or push) elements to an existing collection
206```html
207<!doctype html>
208<html lang="en">
209<head>
210 <meta charset="utf-8">
211 <title>add demo</title>
212 <script src="https://code.jquery.com/jquery-3.3.1.js"></script>
213</head>
214<body>
215
216<p>Hello</p>
217<span id="a">Hello Again</span>
218
219<script>
220var collection = $( "p" );
221// Capture the new collection
222collection = collection.add( document.getElementById( "a" ) );
223collection.css( "background", "yellow" );
224</script>
225
226</body>
227</html>
228```
229 */
230 add(selector_elements_html_selection: JQuery.Selector | JQuery.TypeOrArray<Element> | JQuery.htmlString | JQuery | JQuery.Node): this;
231 /**
232 * Add the previous set of elements on the stack to the current set, optionally filtered by a selector.
233 * @param selector A string containing a selector expression to match the current set of elements against.
234 * @see \`{@link https://api.jquery.com/addBack/ }\`
235 * @since 1.8
236 * @example ​ ````The .addBack() method causes the previous set of DOM elements in the traversal stack to be added to the current set. In the first example, the top stack contains the set resulting from .find(&quot;p&quot;). In the second example, .addBack() adds the previous set of elements on the stack — in this case $(&quot;div.after-addback&quot;) — to the current set, selecting both the div and its enclosed paragraphs.
237```html
238<!doctype html>
239<html lang="en">
240<head>
241 <meta charset="utf-8">
242 <title>addBack demo</title>
243 <style>
244 p, div {
245 margin: 5px;
246 padding: 5px;
247 }
248 .border {
249 border: 2px solid red;
250 }
251 .background {
252 background: yellow;
253 }
254 .left, .right {
255 width: 45%;
256 float: left;
257 }
258 .right {
259 margin-left: 3%;
260 }
261 </style>
262 <script src="https://code.jquery.com/jquery-3.3.1.js"></script>
263</head>
264<body>
265
266<div class="left">
267 <p><strong>Before <code>addBack()</code></strong></p>
268 <div class="before-addback">
269 <p>First Paragraph</p>
270 <p>Second Paragraph</p>
271 </div>
272</div>
273<div class="right">
274 <p><strong>After <code>addBack()</code></strong></p>
275 <div class="after-addback">
276 <p>First Paragraph</p>
277 <p>Second Paragraph</p>
278 </div>
279</div>
280
281<script>
282$( "div.left, div.right" ).find( "div, div > p" ).addClass( "border" );
283
284// First Example
285$( "div.before-addback" ).find( "p" ).addClass( "background" );
286
287// Second Example
288$( "div.after-addback" ).find( "p" ).addBack().addClass( "background" );
289</script>
290
291</body>
292</html>
293```
294 */
295 addBack(selector?: JQuery.Selector): this;
296 /**
297 * Adds the specified class(es) to each element in the set of matched elements.
298 * @param className_function _&#x40;param_ `className_function`
299 * <br>
300 * * `className` — One or more space-separated classes to be added to the class attribute of each matched element. <br>
301 * * `function` — A function returning one or more space-separated class names to be added to the existing class
302 * name(s). Receives the index position of the element in the set and the existing class name(s) as
303 * arguments. Within the function, `this` refers to the current element in the set.
304 * @see \`{@link https://api.jquery.com/addClass/ }\`
305 * @since 1.0
306 * @since 1.4
307 * @since 3.3
308 * @example ​ ````Add the class &quot;selected&quot; to the matched elements.
309```html
310<!doctype html>
311<html lang="en">
312<head>
313 <meta charset="utf-8">
314 <title>addClass demo</title>
315 <style>
316 p {
317 margin: 8px;
318 font-size: 16px;
319 }
320 .selected {
321 color: blue;
322 }
323 .highlight {
324 background: yellow;
325 }
326 </style>
327 <script src="https://code.jquery.com/jquery-3.3.1.js"></script>
328</head>
329<body>
330
331<p>Hello</p>
332<p>and</p>
333<p>Goodbye</p>
334
335<script>
336$( "p" ).last().addClass( "selected" );
337</script>
338
339</body>
340</html>
341```
342 * @example ​ ````Add the classes &quot;selected&quot; and &quot;highlight&quot; to the matched elements.
343```html
344<!doctype html>
345<html lang="en">
346<head>
347 <meta charset="utf-8">
348 <title>addClass demo</title>
349 <style>
350 p {
351 margin: 8px;
352 font-size: 16px;
353 }
354 .selected {
355 color: red;
356 }
357 .highlight {
358 background: yellow;
359 }
360 </style>
361 <script src="https://code.jquery.com/jquery-3.3.1.js"></script>
362</head>
363<body>
364
365<p>Hello</p>
366<p>and</p>
367<p>Goodbye</p>
368
369<script>
370$( "p:last" ).addClass( "selected highlight" );
371</script>
372
373</body>
374</html>
375```
376 * @example ​ ````Pass in a function to .addClass() to add the &quot;green&quot; class to a div that already has a &quot;red&quot; class.
377```html
378<!doctype html>
379<html lang="en">
380<head>
381 <meta charset="utf-8">
382 <title>addClass demo</title>
383 <style>
384 div {
385 background: white;
386 }
387 .red {
388 background: red;
389 }
390 .red.green {
391 background: green;
392 }
393 </style>
394 <script src="https://code.jquery.com/jquery-3.3.1.js"></script>
395</head>
396<body>
397
398 <div>This div should be white</div>
399 <div class="red">This div will be green because it now has the "green" and "red" classes.
400 It would be red if the addClass function failed.</div>
401 <div>This div should be white</div>
402 <p>There are zero green divs</p>
403
404<script>
405$( "div" ).addClass(function( index, currentClass ) {
406 var addedClass;
407
408 if ( currentClass === "red" ) {
409 addedClass = "green";
410 $( "p" ).text( "There is one green div" );
411 }
412
413 return addedClass;
414});
415</script>
416
417</body>
418</html>
419```
420 */
421 addClass(className_function: JQuery.TypeOrArray<string> | ((this: TElement, index: number, currentClassName: string) => string)): this;
422 /**
423 * Insert content, specified by the parameter, after each element in the set of matched elements.
424 * @param contents One or more additional DOM elements, text nodes, arrays of elements and text nodes, HTML strings, or
425 * jQuery objects to insert after each element in the set of matched elements.
426 * @see \`{@link https://api.jquery.com/after/ }\`
427 * @since 1.0
428 * @example ​ ````Inserts some HTML after all paragraphs.
429```html
430<!doctype html>
431<html lang="en">
432<head>
433 <meta charset="utf-8">
434 <title>after demo</title>
435 <style>
436 p {
437 background: yellow;
438 }
439 </style>
440 <script src="https://code.jquery.com/jquery-3.3.1.js"></script>
441</head>
442<body>
443
444<p>I would like to say: </p>
445
446<script>
447$( "p" ).after( "<b>Hello</b>" );
448</script>
449
450</body>
451</html>
452```
453 * @example ​ ````Inserts a DOM element after all paragraphs.
454```html
455<!doctype html>
456<html lang="en">
457<head>
458 <meta charset="utf-8">
459 <title>after demo</title>
460 <style>
461 p {
462 background: yellow;
463 }
464 </style>
465 <script src="https://code.jquery.com/jquery-3.3.1.js"></script>
466</head>
467<body>
468
469<p>I would like to say: </p>
470
471<script>
472$( "p" ).after( document.createTextNode( "Hello" ) );
473</script>
474
475</body>
476</html>
477```
478 * @example ​ ````Inserts a jQuery object (similar to an Array of DOM Elements) after all paragraphs.
479```html
480<!doctype html>
481<html lang="en">
482<head>
483 <meta charset="utf-8">
484 <title>after demo</title>
485 <style>
486 p {
487 background: yellow;
488 }
489 </style>
490 <script src="https://code.jquery.com/jquery-3.3.1.js"></script>
491</head>
492<body>
493
494<b>Hello</b>
495<p>I would like to say: </p>
496
497<script>
498$( "p" ).after( $( "b" ) );
499</script>
500
501</body>
502</html>
503```
504 */
505 after(...contents: Array<JQuery.htmlString | JQuery.TypeOrArray<JQuery.Node | JQuery<JQuery.Node>>>): this;
506 /**
507 * Insert content, specified by the parameter, after each element in the set of matched elements.
508 * @param function_functionーhtml _&#x40;param_ `function_functionーhtml`
509 * <br>
510 * * `function` — A function that returns an HTML string, DOM element(s), text node(s), or jQuery object to insert
511 * after each element in the set of matched elements. Receives the index position of the element in the
512 * set as an argument. Within the function, `this` refers to the current element in the set. <br>
513 * * `functionーhtml` — A function that returns an HTML string, DOM element(s), text node(s), or jQuery object to insert
514 * after each element in the set of matched elements. Receives the index position of the element in the
515 * set and the old HTML value of the element as arguments. Within the function, `this` refers to the
516 * current element in the set.
517 * @see \`{@link https://api.jquery.com/after/ }\`
518 * @since 1.4
519 * @since 1.10
520 */
521 after(function_functionhtml: (this: TElement, index: number, html: string) => JQuery.htmlString | JQuery.TypeOrArray<JQuery.Node | JQuery<JQuery.Node>>): this;
522 /**
523 * Register a handler to be called when Ajax requests complete. This is an AjaxEvent.
524 * @param handler The function to be invoked.
525 * @see \`{@link https://api.jquery.com/ajaxComplete/ }\`
526 * @since 1.0
527 * @example ​ ````Show a message when an Ajax request completes.
528```javascript
529$( document ).ajaxComplete(function( event, request, settings ) {
530 $( "#msg" ).append( "<li>Request Complete.</li>" );
531});
532```
533 */
534 ajaxComplete(handler: (this: Document,
535 event: JQuery.TriggeredEvent<Document, undefined, Document, Document>,
536 jqXHR: JQuery.jqXHR,
537 ajaxOptions: JQuery.AjaxSettings) => void | false): this;
538 /**
539 * Register a handler to be called when Ajax requests complete with an error. This is an Ajax Event.
540 * @param handler The function to be invoked.
541 * @see \`{@link https://api.jquery.com/ajaxError/ }\`
542 * @since 1.0
543 * @example ​ ````Show a message when an Ajax request fails.
544```javascript
545$( document ).ajaxError(function( event, request, settings ) {
546 $( "#msg" ).append( "<li>Error requesting page " + settings.url + "</li>" );
547});
548```
549 */
550 ajaxError(handler: (this: Document,
551 event: JQuery.TriggeredEvent<Document, undefined, Document, Document>,
552 jqXHR: JQuery.jqXHR,
553 ajaxSettings: JQuery.AjaxSettings,
554 thrownError: string) => void | false): this;
555 /**
556 * Attach a function to be executed before an Ajax request is sent. This is an Ajax Event.
557 * @param handler The function to be invoked.
558 * @see \`{@link https://api.jquery.com/ajaxSend/ }\`
559 * @since 1.0
560 * @example ​ ````Show a message before an Ajax request is sent.
561```javascript
562$( document ).ajaxSend(function( event, request, settings ) {
563 $( "#msg" ).append( "<li>Starting request at " + settings.url + "</li>" );
564});
565```
566 */
567 ajaxSend(handler: (this: Document,
568 event: JQuery.TriggeredEvent<Document, undefined, Document, Document>,
569 jqXHR: JQuery.jqXHR,
570 ajaxOptions: JQuery.AjaxSettings) => void | false): this;
571 /**
572 * Register a handler to be called when the first Ajax request begins. This is an Ajax Event.
573 * @param handler The function to be invoked.
574 * @see \`{@link https://api.jquery.com/ajaxStart/ }\`
575 * @since 1.0
576 * @example ​ ````Show a loading message whenever an Ajax request starts (and none is already active).
577```javascript
578$( document ).ajaxStart(function() {
579 $( "#loading" ).show();
580});
581```
582 */
583 ajaxStart(handler: (this: Document) => void | false): this;
584 /**
585 * Register a handler to be called when all Ajax requests have completed. This is an Ajax Event.
586 * @param handler The function to be invoked.
587 * @see \`{@link https://api.jquery.com/ajaxStop/ }\`
588 * @since 1.0
589 * @example ​ ````Hide a loading message after all the Ajax requests have stopped.
590```javascript
591$( document ).ajaxStop(function() {
592 $( "#loading" ).hide();
593});
594```
595 */
596 ajaxStop(handler: (this: Document) => void | false): this;
597 /**
598 * Attach a function to be executed whenever an Ajax request completes successfully. This is an Ajax Event.
599 * @param handler The function to be invoked.
600 * @see \`{@link https://api.jquery.com/ajaxSuccess/ }\`
601 * @since 1.0
602 * @example ​ ````Show a message when an Ajax request completes successfully.
603```javascript
604$( document ).ajaxSuccess(function( event, request, settings ) {
605 $( "#msg" ).append( "<li>Successful Request!</li>" );
606});
607```
608 */
609 ajaxSuccess(handler: (this: Document,
610 event: JQuery.TriggeredEvent<Document, undefined, Document, Document>,
611 jqXHR: JQuery.jqXHR,
612 ajaxOptions: JQuery.AjaxSettings,
613 data: JQuery.PlainObject) => void | false): this;
614 /**
615 * Perform a custom animation of a set of CSS properties.
616 * @param properties An object of CSS properties and values that the animation will move toward.
617 * @param duration A string or number determining how long the animation will run.
618 * @param easing A string indicating which easing function to use for the transition.
619 * @param complete A function to call once the animation is complete, called once per matched element.
620 * @see \`{@link https://api.jquery.com/animate/ }\`
621 * @since 1.0
622 * @example ​ ````An example of using an &#39;easing&#39; function to provide a different style of animation. This will only work if you have a plugin that provides this easing function. Note, this code will do nothing unless the paragraph element is hidden.
623```javascript
624$( "p" ).animate({
625 opacity: "show"
626}, "slow", "easein" );
627```
628 * @example ​ ````Animate all paragraphs and execute a callback function when the animation is complete. The first argument is an object of CSS properties, the second specifies that the animation should take 1000 milliseconds to complete, the third states the easing type, and the fourth argument is an anonymous callback function.
629```javascript
630$( "p" ).animate({
631 height: 200,
632 width: 400,
633 opacity: 0.5
634}, 1000, "linear", function() {
635 alert( "all done" );
636});
637```
638 */
639 animate(properties: JQuery.PlainObject,
640 duration: JQuery.Duration,
641 easing: string,
642 complete?: (this: TElement) => void): this;
643 /**
644 * Perform a custom animation of a set of CSS properties.
645 * @param properties An object of CSS properties and values that the animation will move toward.
646 * @param duration_easing _&#x40;param_ `duration_easing`
647 * <br>
648 * * `duration` — A string or number determining how long the animation will run. <br>
649 * * `easing` — A string indicating which easing function to use for the transition.
650 * @param complete A function to call once the animation is complete, called once per matched element.
651 * @see \`{@link https://api.jquery.com/animate/ }\`
652 * @since 1.0
653 * @example ​ ````Click the button to animate the div with a number of different properties.
654```html
655<!doctype html>
656<html lang="en">
657<head>
658 <meta charset="utf-8">
659 <title>animate demo</title>
660 <style>
661 div {
662 background-color: #bca;
663 width: 100px;
664 border: 1px solid green;
665 }
666 </style>
667 <script src="https://code.jquery.com/jquery-3.3.1.js"></script>
668</head>
669<body>
670
671<button id="go">&raquo; Run</button>
672<div id="block">Hello!</div>
673
674<script>
675// Using multiple unit types within one animation.
676
677$( "#go" ).click(function() {
678 $( "#block" ).animate({
679 width: "70%",
680 opacity: 0.4,
681 marginLeft: "0.6in",
682 fontSize: "3em",
683 borderWidth: "10px"
684 }, 1500 );
685});
686</script>
687
688</body>
689</html>
690```
691 * @example ​ ````Animates a div&#39;s left property with a relative value. Click several times on the buttons to see the relative animations queued up.
692```html
693<!doctype html>
694<html lang="en">
695<head>
696 <meta charset="utf-8">
697 <title>animate demo</title>
698 <style>
699 div {
700 position: absolute;
701 background-color: #abc;
702 left: 50px;
703 width: 90px;
704 height: 90px;
705 margin: 5px;
706 }
707 </style>
708 <script src="https://code.jquery.com/jquery-3.3.1.js"></script>
709</head>
710<body>
711
712<button id="left">&laquo;</button>
713<button id="right">&raquo;</button>
714<div class="block"></div>
715
716<script>
717$( "#right" ).click(function() {
718 $( ".block" ).animate({ "left": "+=50px" }, "slow" );
719});
720
721$( "#left" ).click(function(){
722 $( ".block" ).animate({ "left": "-=50px" }, "slow" );
723});
724</script>
725
726</body>
727</html>
728```
729 * @example ​ ````Animate all paragraphs to toggle both height and opacity, completing the animation within 600 milliseconds.
730```javascript
731$( "p" ).animate({
732 height: "toggle",
733 opacity: "toggle"
734}, "slow" );
735```
736 * @example ​ ````Animate all paragraphs to a left style of 50 and opacity of 1 (opaque, visible), completing the animation within 500 milliseconds.
737```javascript
738$( "p" ).animate({
739 left: 50,
740 opacity: 1
741}, 500 );
742```
743 */
744 animate(properties: JQuery.PlainObject,
745 duration_easing: JQuery.Duration | string,
746 complete?: (this: TElement) => void): this;
747 /**
748 * Perform a custom animation of a set of CSS properties.
749 * @param properties An object of CSS properties and values that the animation will move toward.
750 * @param options A map of additional options to pass to the method.
751 * @see \`{@link https://api.jquery.com/animate/ }\`
752 * @since 1.0
753 * @example ​ ````The first button shows how an unqueued animation works. It expands the div out to 90% width while the font-size is increasing. Once the font-size change is complete, the border animation will begin.
754
755The second button starts a traditional chained animation, where each animation will start once the previous animation on the element has completed.
756```html
757<!doctype html>
758<html lang="en">
759<head>
760 <meta charset="utf-8">
761 <title>animate demo</title>
762 <style>
763 div {
764 background-color: #bca;
765 width: 200px;
766 height: 1.1em;
767 text-align: center;
768 border: 2px solid green;
769 margin: 3px;
770 font-size: 14px;
771 }
772 button {
773 font-size: 14px;
774 }
775 </style>
776 <script src="https://code.jquery.com/jquery-3.3.1.js"></script>
777</head>
778<body>
779
780<button id="go1">&raquo; Animate Block1</button>
781<button id="go2">&raquo; Animate Block2</button>
782<button id="go3">&raquo; Animate Both</button>
783<button id="go4">&raquo; Reset</button>
784<div id="block1">Block1</div>
785<div id="block2">Block2</div>
786
787<script>
788$( "#go1" ).click(function() {
789 $( "#block1" )
790 .animate({
791 width: "90%"
792 }, {
793 queue: false,
794 duration: 3000
795 })
796 .animate({ fontSize: "24px" }, 1500 )
797 .animate({ borderRightWidth: "15px" }, 1500 );
798});
799
800$( "#go2" ).click(function() {
801 $( "#block2" )
802 .animate({ width: "90%" }, 1000 )
803 .animate({ fontSize: "24px" }, 1000 )
804 .animate({ borderLeftWidth: "15px" }, 1000 );
805});
806
807$( "#go3" ).click(function() {
808 $( "#go1" ).add( "#go2" ).click();
809});
810
811$( "#go4" ).click(function() {
812 $( "div" ).css({
813 width: "",
814 fontSize: "",
815 borderWidth: ""
816 });
817});
818</script>
819
820</body>
821</html>
822```
823 * @example ​ ````Animates the first div&#39;s left property and synchronizes the remaining divs, using the step function to set their left properties at each stage of the animation.
824```html
825<!doctype html>
826<html lang="en">
827<head>
828 <meta charset="utf-8">
829 <title>animate demo</title>
830 <style>
831 div {
832 position: relative;
833 background-color: #abc;
834 width: 40px;
835 height: 40px;
836 float: left;
837 margin: 5px;
838 }
839 </style>
840 <script src="https://code.jquery.com/jquery-3.3.1.js"></script>
841</head>
842<body>
843
844<p><button id="go">Run »</button></p>
845<div class="block"></div>
846<div class="block"></div>
847<div class="block"></div>
848<div class="block"></div>
849<div class="block"></div>
850<div class="block"></div>
851
852<script>
853$( "#go" ).click(function() {
854 $( ".block:first" ).animate({
855 left: 100
856 }, {
857 duration: 1000,
858 step: function( now, fx ){
859 $( ".block:gt(0)" ).css( "left", now );
860 }
861 });
862});
863</script>
864
865</body>
866</html>
867```
868 * @example ​ ````Animate the left and opacity style properties of all paragraphs; run the animation outside the queue, so that it will automatically start without waiting for its turn.
869```javascript
870$( "p" ).animate({
871 left: "50px",
872 opacity: 1
873}, {
874 duration: 500,
875 queue: false
876});
877```
878 * @example ​ ````Animates all paragraphs to toggle both height and opacity, completing the animation within 600 milliseconds.
879```javascript
880$( "p" ).animate({
881 height: "toggle",
882 opacity: "toggle"
883}, {
884 duration: "slow"
885});
886```
887 * @example ​ ````Use an easing function to provide a different style of animation. This will only work if you have a plugin that provides this easing function.
888```javascript
889$( "p" ).animate({
890 opacity: "show"
891}, {
892 duration: "slow",
893 easing: "easein"
894});
895```
896 */
897 animate(properties: JQuery.PlainObject,
898 options: JQuery.EffectsOptions<TElement>): this;
899 /**
900 * Perform a custom animation of a set of CSS properties.
901 * @param properties An object of CSS properties and values that the animation will move toward.
902 * @param complete A function to call once the animation is complete, called once per matched element.
903 * @see \`{@link https://api.jquery.com/animate/ }\`
904 * @since 1.0
905 */
906 animate(properties: JQuery.PlainObject,
907 complete?: (this: TElement) => void): this;
908 /**
909 * Insert content, specified by the parameter, to the end of each element in the set of matched elements.
910 * @param contents One or more additional DOM elements, text nodes, arrays of elements and text nodes, HTML strings, or
911 * jQuery objects to insert at the end of each element in the set of matched elements.
912 * @see \`{@link https://api.jquery.com/append/ }\`
913 * @since 1.0
914 * @example ​ ````Appends some HTML to all paragraphs.
915```html
916<!doctype html>
917<html lang="en">
918<head>
919 <meta charset="utf-8">
920 <title>append demo</title>
921 <style>
922 p {
923 background: yellow;
924 }
925 </style>
926 <script src="https://code.jquery.com/jquery-3.3.1.js"></script>
927</head>
928<body>
929
930<p>I would like to say: </p>
931
932<script>
933$( "p" ).append( "<strong>Hello</strong>" );
934</script>
935
936</body>
937</html>
938```
939 * @example ​ ````Appends an Element to all paragraphs.
940```html
941<!doctype html>
942<html lang="en">
943<head>
944 <meta charset="utf-8">
945 <title>append demo</title>
946 <style>
947 p {
948 background: yellow;
949 }
950 </style>
951 <script src="https://code.jquery.com/jquery-3.3.1.js"></script>
952</head>
953<body>
954
955<p>I would like to say: </p>
956
957<script>
958$( "p" ).append( document.createTextNode( "Hello" ) );
959</script>
960
961</body>
962</html>
963```
964 * @example ​ ````Appends a jQuery object (similar to an Array of DOM Elements) to all paragraphs.
965```html
966<!doctype html>
967<html lang="en">
968<head>
969 <meta charset="utf-8">
970 <title>append demo</title>
971 <style>
972 p {
973 background: yellow;
974 }
975 </style>
976 <script src="https://code.jquery.com/jquery-3.3.1.js"></script>
977</head>
978<body>
979
980<strong>Hello world!!!</strong>
981<p>I would like to say: </p>
982
983<script>
984$( "p" ).append( $( "strong" ) );
985</script>
986
987</body>
988</html>
989```
990 */
991 append(...contents: Array<JQuery.htmlString | JQuery.TypeOrArray<JQuery.Node | JQuery<JQuery.Node>>>): this;
992 /**
993 * Insert content, specified by the parameter, to the end of each element in the set of matched elements.
994 * @param funсtion A function that returns an HTML string, DOM element(s), text node(s), or jQuery object to insert at
995 * the end of each element in the set of matched elements. Receives the index position of the element
996 * in the set and the old HTML value of the element as arguments. Within the function, `this` refers to
997 * the current element in the set.
998 * @see \`{@link https://api.jquery.com/append/ }\`
999 * @since 1.4
1000 */
1001 append(funсtion: (this: TElement, index: number, html: string) => JQuery.htmlString | JQuery.TypeOrArray<JQuery.Node | JQuery<JQuery.Node>>): this;
1002 /**
1003 * Insert every element in the set of matched elements to the end of the target.
1004 * @param target A selector, element, HTML string, array of elements, or jQuery object; the matched set of elements
1005 * will be inserted at the end of the element(s) specified by this parameter.
1006 * @see \`{@link https://api.jquery.com/appendTo/ }\`
1007 * @since 1.0
1008 * @example ​ ````Append all spans to the element with the ID &quot;foo&quot; (Check append() documentation for more examples)
1009```html
1010<!doctype html>
1011<html lang="en">
1012<head>
1013 <meta charset="utf-8">
1014 <title>appendTo demo</title>
1015 <style>
1016 #foo {
1017 background: yellow;
1018 }
1019 </style>
1020 <script src="https://code.jquery.com/jquery-3.3.1.js"></script>
1021</head>
1022<body>
1023
1024<span>I have nothing more to say... </span>
1025
1026<div id="foo">FOO! </div>
1027
1028<script>
1029$( "span" ).appendTo( "#foo" );
1030</script>
1031
1032</body>
1033</html>
1034```
1035 */
1036 appendTo(target: JQuery.Selector | JQuery.htmlString | JQuery.TypeOrArray<Element | DocumentFragment> | JQuery): this;
1037 /**
1038 * Set one or more attributes for the set of matched elements.
1039 * @param attributeName The name of the attribute to set.
1040 * @param value_function _&#x40;param_ `value_function`
1041 * <br>
1042 * * `value` — A value to set for the attribute. If `null`, the specified attribute will be removed (as in \`{@link removeAttr .removeAttr()}`). <br>
1043 * * `function` — A function returning the value to set. `this` is the current element. Receives the index position of
1044 * the element in the set and the old attribute value as arguments.
1045 * @see \`{@link https://api.jquery.com/attr/ }\`
1046 * @since 1.0
1047 * @since 1.1
1048 * @example ​ ````Set the id for divs based on the position in the page.
1049```html
1050<!doctype html>
1051<html lang="en">
1052<head>
1053 <meta charset="utf-8">
1054 <title>attr demo</title>
1055 <style>
1056 div {
1057 color: blue;
1058 }
1059 span {
1060 color: red;
1061 }
1062 b {
1063 font-weight: bolder;
1064 }
1065 </style>
1066 <script src="https://code.jquery.com/jquery-3.3.1.js"></script>
1067</head>
1068<body>
1069
1070<div>Zero-th <span></span></div>
1071<div>First <span></span></div>
1072<div>Second <span></span></div>
1073
1074<script>
1075$( "div" )
1076 .attr( "id", function( arr ) {
1077 return "div-id" + arr;
1078 })
1079 .each(function() {
1080 $( "span", this ).html( "(id = '<b>" + this.id + "</b>')" );
1081});
1082</script>
1083
1084</body>
1085</html>
1086```
1087 * @example ​ ````Set the src attribute from title attribute on the image.
1088```html
1089<!doctype html>
1090<html lang="en">
1091<head>
1092 <meta charset="utf-8">
1093 <title>attr demo</title>
1094 <script src="https://code.jquery.com/jquery-3.3.1.js"></script>
1095</head>
1096<body>
1097
1098<img title="hat.gif">
1099
1100<script>
1101$( "img" ).attr( "src", function() {
1102 return "/resources/" + this.title;
1103});
1104</script>
1105
1106</body>
1107</html>
1108```
1109 */
1110 attr(attributeName: string,
1111 value_function: string | number | null | ((this: TElement, index: number, attr: string) => string | number | void | undefined)): this;
1112 /**
1113 * Set one or more attributes for the set of matched elements.
1114 * @param attributes An object of attribute-value pairs to set.
1115 * @see \`{@link https://api.jquery.com/attr/ }\`
1116 * @since 1.0
1117 * @example ​ ````Set some attributes for all &lt;img&gt;s in the page.
1118```html
1119<!doctype html>
1120<html lang="en">
1121<head>
1122 <meta charset="utf-8">
1123 <title>attr demo</title>
1124 <style>
1125 img {
1126 padding: 10px;
1127 }
1128 div {
1129 color: red;
1130 font-size: 24px;
1131 }
1132 </style>
1133 <script src="https://code.jquery.com/jquery-3.3.1.js"></script>
1134</head>
1135<body>
1136
1137<img>
1138<img>
1139<img>
1140
1141<div><b>Attribute of Ajax</b></div>
1142
1143<script>
1144$( "img" ).attr({
1145 src: "/resources/hat.gif",
1146 title: "jQuery",
1147 alt: "jQuery Logo"
1148});
1149$( "div" ).text( $( "img" ).attr( "alt" ) );
1150</script>
1151
1152</body>
1153</html>
1154```
1155 */
1156 attr(attributes: JQuery.PlainObject): this;
1157 /**
1158 * Get the value of an attribute for the first element in the set of matched elements.
1159 * @param attributeName The name of the attribute to get.
1160 * @see \`{@link https://api.jquery.com/attr/ }\`
1161 * @since 1.0
1162 * @example ​ ````Display the checked attribute and property of a checkbox as it changes.
1163```html
1164<!doctype html>
1165<html lang="en">
1166<head>
1167 <meta charset="utf-8">
1168 <title>attr demo</title>
1169 <style>
1170 p {
1171 margin: 20px 0 0;
1172 }
1173 b {
1174 color: blue;
1175 }
1176 </style>
1177 <script src="https://code.jquery.com/jquery-3.3.1.js"></script>
1178</head>
1179<body>
1180
1181<input id="check1" type="checkbox" checked="checked">
1182<label for="check1">Check me</label>
1183<p></p>
1184
1185<script>
1186$( "input" )
1187 .change(function() {
1188 var $input = $( this );
1189 $( "p" ).html( ".attr( 'checked' ): <b>" + $input.attr( "checked" ) + "</b><br>" +
1190 ".prop( 'checked' ): <b>" + $input.prop( "checked" ) + "</b><br>" +
1191 ".is( ':checked' ): <b>" + $input.is( ":checked" ) + "</b>" );
1192 })
1193 .change();
1194</script>
1195
1196</body>
1197</html>
1198```
1199 * @example ​ ````Find the title attribute of the first &lt;em&gt; in the page.
1200```html
1201<!doctype html>
1202<html lang="en">
1203<head>
1204 <meta charset="utf-8">
1205 <title>attr demo</title>
1206 <style>
1207 em {
1208 color: blue;
1209 font-weight: bold;
1210 }
1211 div {
1212 color: red;
1213 }
1214 </style>
1215 <script src="https://code.jquery.com/jquery-3.3.1.js"></script>
1216</head>
1217<body>
1218
1219<p>Once there was a <em title="huge, gigantic">large</em> dinosaur...</p>
1220
1221The title of the emphasis is:<div></div>
1222
1223<script>
1224var title = $( "em" ).attr( "title" );
1225$( "div" ).text( title );
1226</script>
1227
1228</body>
1229</html>
1230```
1231 */
1232 attr(attributeName: string): string | undefined;
1233 /**
1234 * Insert content, specified by the parameter, before each element in the set of matched elements.
1235 * @param contents One or more additional DOM elements, text nodes, arrays of elements and text nodes, HTML strings, or
1236 * jQuery objects to insert before each element in the set of matched elements.
1237 * @see \`{@link https://api.jquery.com/before/ }\`
1238 * @since 1.0
1239 * @example ​ ````Inserts some HTML before all paragraphs.
1240```html
1241<!doctype html>
1242<html lang="en">
1243<head>
1244 <meta charset="utf-8">
1245 <title>before demo</title>
1246 <style>
1247 p {
1248 background: yellow;
1249 }
1250 </style>
1251 <script src="https://code.jquery.com/jquery-3.3.1.js"></script>
1252</head>
1253<body>
1254
1255<p> is what I said...</p>
1256
1257<script>
1258$( "p" ).before( "<b>Hello</b>" );
1259</script>
1260
1261</body>
1262</html>
1263```
1264 * @example ​ ````Inserts a DOM element before all paragraphs.
1265```html
1266<!doctype html>
1267<html lang="en">
1268<head>
1269 <meta charset="utf-8">
1270 <title>before demo</title>
1271 <style>
1272 p {
1273 background: yellow;
1274 }
1275 </style>
1276 <script src="https://code.jquery.com/jquery-3.3.1.js"></script>
1277</head>
1278<body>
1279
1280<p> is what I said...</p>
1281
1282<script>
1283$( "p" ).before( document.createTextNode( "Hello" ) );
1284</script>
1285
1286</body>
1287</html>
1288```
1289 * @example ​ ````Inserts a jQuery object (similar to an Array of DOM Elements) before all paragraphs.
1290```html
1291<!doctype html>
1292<html lang="en">
1293<head>
1294 <meta charset="utf-8">
1295 <title>before demo</title>
1296 <style>
1297 p {
1298 background: yellow;
1299 }
1300 </style>
1301 <script src="https://code.jquery.com/jquery-3.3.1.js"></script>
1302</head>
1303<body>
1304
1305<p> is what I said...</p><b>Hello</b>
1306
1307<script>
1308$( "p" ).before( $( "b" ) );
1309</script>
1310
1311</body>
1312</html>
1313```
1314 */
1315 before(...contents: Array<JQuery.htmlString | JQuery.TypeOrArray<JQuery.Node | JQuery<JQuery.Node>>>): this;
1316 /**
1317 * Insert content, specified by the parameter, before each element in the set of matched elements.
1318 * @param function_functionーhtml _&#x40;param_ `function_functionーhtml`
1319 * <br>
1320 * * `function` — A function that returns an HTML string, DOM element(s), text node(s), or jQuery object to insert
1321 * before each element in the set of matched elements. Receives the index position of the element in
1322 * the set as an argument. Within the function, `this` refers to the current element in the set. <br>
1323 * * `functionーhtml` — A function that returns an HTML string, DOM element(s), text node(s), or jQuery object to insert
1324 * before each element in the set of matched elements. Receives the index position of the element in
1325 * the set and the old HTML value of the element as arguments. Within the function, `this` refers to the
1326 * current element in the set.
1327 * @see \`{@link https://api.jquery.com/before/ }\`
1328 * @since 1.4
1329 * @since 1.10
1330 */
1331 before(function_functionhtml: (this: TElement, index: number, html: string) => JQuery.htmlString | JQuery.TypeOrArray<JQuery.Node | JQuery<JQuery.Node>>): this;
1332 // [bind() overloads] https://github.com/jquery/api.jquery.com/issues/1048
1333 /**
1334 * Attach a handler to an event for the elements.
1335 * @param eventType A string containing one or more DOM event types, such as "click" or "submit," or custom event names.
1336 * @param eventData An object containing data that will be passed to the event handler.
1337 * @param handler A function to execute each time the event is triggered.
1338 * @see \`{@link https://api.jquery.com/bind/ }\`
1339 * @since 1.0
1340 * @since 1.4.3
1341 * @deprecated ​ Deprecated since 3.0. Use \`{@link on }\`.
1342 *
1343 * **Cause**: These event binding methods have been deprecated in favor of the `.on()` and `.off()` methods which can handle both delegated and direct event binding. Although the older methods are still present in jQuery 3.0, they may be removed as early as the next major-version update.
1344 *
1345 * **Solution**: Change the method call to use `.on()` or `.off()`, the documentation for the old methods include specific instructions. In general, the `.bind()` and `.unbind()` methods can be renamed directly to `.on()` and `.off()` respectively since the argument orders are identical.
1346 */
1347 bind<TType extends string,
1348 TData>(
1349 eventType: TType,
1350 eventData: TData,
1351 handler: JQuery.TypeEventHandler<TElement, TData, TElement, TElement, TType>
1352 ): this;
1353 /**
1354 * Attach a handler to an event for the elements.
1355 * @param eventType A string containing one or more DOM event types, such as "click" or "submit," or custom event names.
1356 * @param handler_preventBubble _&#x40;param_ `handler_preventBubble`
1357 * <br>
1358 * * `handler` — A function to execute each time the event is triggered. <br>
1359 * * `preventBubble` — Setting the third argument to false will attach a function that prevents the default action from
1360 * occurring and stops the event from bubbling. The default is `true`.
1361 * @see \`{@link https://api.jquery.com/bind/ }\`
1362 * @since 1.0
1363 * @since 1.4.3
1364 * @deprecated ​ Deprecated since 3.0. Use \`{@link on }\`.
1365 *
1366 * **Cause**: These event binding methods have been deprecated in favor of the `.on()` and `.off()` methods which can handle both delegated and direct event binding. Although the older methods are still present in jQuery 3.0, they may be removed as early as the next major-version update.
1367 *
1368 * **Solution**: Change the method call to use `.on()` or `.off()`, the documentation for the old methods include specific instructions. In general, the `.bind()` and `.unbind()` methods can be renamed directly to `.on()` and `.off()` respectively since the argument orders are identical.
1369 * @example ​ ````Handle click and double-click for the paragraph. Note: the coordinates are window relative, so in this case relative to the demo iframe.
1370```html
1371<!doctype html>
1372<html lang="en">
1373<head>
1374 <meta charset="utf-8">
1375 <title>bind demo</title>
1376 <style>
1377 p {
1378 background: yellow;
1379 font-weight: bold;
1380 cursor: pointer;
1381 padding: 5px;
1382 }
1383 p.over {
1384 background: #ccc;
1385 }
1386 span {
1387 color: red;
1388 }
1389 </style>
1390 <script src="https://code.jquery.com/jquery-3.3.1.js"></script>
1391</head>
1392<body>
1393
1394<p>Click or double click here.</p>
1395<span></span>
1396
1397<script>
1398$( "p" ).bind( "click", function( event ) {
1399 var str = "( " + event.pageX + ", " + event.pageY + " )";
1400 $( "span" ).text( "Click happened! " + str );
1401});
1402$( "p" ).bind( "dblclick", function() {
1403 $( "span" ).text( "Double-click happened in " + this.nodeName );
1404});
1405$( "p" ).bind( "mouseenter mouseleave", function( event ) {
1406 $( this ).toggleClass( "over" );
1407});
1408</script>
1409
1410</body>
1411</html>
1412```
1413 * @example ​ ````To display each paragraph&#39;s text in an alert box whenever it is clicked:
1414```javascript
1415$( "p" ).bind( "click", function() {
1416 alert( $( this ).text() );
1417});
1418```
1419 * @example ​ ````Cancel a default action and prevent it from bubbling up by returning false:
1420```javascript
1421$( "form" ).bind( "submit", function() {
1422 return false;
1423})
1424```
1425 * @example ​ ````Cancel only the default action by using the .preventDefault() method.
1426```javascript
1427$( "form" ).bind( "submit", function( event ) {
1428 event.preventDefault();
1429});
1430```
1431 * @example ​ ````Stop an event from bubbling without preventing the default action by using the .stopPropagation() method.
1432```javascript
1433$( "form" ).bind( "submit", function( event ) {
1434 event.stopPropagation();
1435});
1436```
1437 * @example ​ ````Bind custom events.
1438```html
1439<!doctype html>
1440<html lang="en">
1441<head>
1442 <meta charset="utf-8">
1443 <title>bind demo</title>
1444 <style>
1445 p {
1446 color: red;
1447 }
1448 span {
1449 color: blue;
1450 }
1451 </style>
1452 <script src="https://code.jquery.com/jquery-3.3.1.js"></script>
1453</head>
1454<body>
1455
1456<p>Has an attached custom event.</p>
1457<button>Trigger custom event</button>
1458<span style="display: none;"></span>
1459
1460<script>
1461$( "p" ).bind( "myCustomEvent", function( e, myName, myValue ) {
1462 $( this ).text( myName + ", hi there!" );
1463 $( "span" )
1464 .stop()
1465 .css( "opacity", 1 )
1466 .text( "myName = " + myName )
1467 .fadeIn( 30 )
1468 .fadeOut( 1000 );
1469 });
1470$( "button" ).click(function() {
1471 $( "p" ).trigger( "myCustomEvent", [ "John" ] );
1472});
1473</script>
1474
1475</body>
1476</html>
1477```
1478 */
1479 bind<TType extends string>(
1480 eventType: TType,
1481 handler_preventBubble: JQuery.TypeEventHandler<TElement, undefined, TElement, TElement, TType> |
1482 false |
1483 null |
1484 undefined
1485 ): this;
1486 /**
1487 * Attach a handler to an event for the elements.
1488 * @param events An object containing one or more DOM event types and functions to execute for them.
1489 * @see \`{@link https://api.jquery.com/bind/ }\`
1490 * @since 1.4
1491 * @deprecated ​ Deprecated since 3.0. Use \`{@link on }\`.
1492 *
1493 * **Cause**: These event binding methods have been deprecated in favor of the `.on()` and `.off()` methods which can handle both delegated and direct event binding. Although the older methods are still present in jQuery 3.0, they may be removed as early as the next major-version update.
1494 *
1495 * **Solution**: Change the method call to use `.on()` or `.off()`, the documentation for the old methods include specific instructions. In general, the `.bind()` and `.unbind()` methods can be renamed directly to `.on()` and `.off()` respectively since the argument orders are identical.
1496 * @example ​ ````Bind multiple events simultaneously.
1497```javascript
1498$( "div.test" ).bind({
1499 click: function() {
1500 $( this ).addClass( "active" );
1501 },
1502 mouseenter: function() {
1503 $( this ).addClass( "inside" );
1504 },
1505 mouseleave: function() {
1506 $( this ).removeClass( "inside" );
1507 }
1508});
1509```
1510 */
1511 bind(events: JQuery.TypeEventHandlers<TElement, undefined, TElement, TElement>): this;
1512 /**
1513 * Bind an event handler to the "blur" JavaScript event, or trigger that event on an element.
1514 * @param eventData An object containing data that will be passed to the event handler.
1515 * @param handler A function to execute each time the event is triggered.
1516 * @see \`{@link https://api.jquery.com/blur/ }\`
1517 * @since 1.4.3
1518 * @deprecated ​ Deprecated since 3.3. Use \`{@link on }\` or \`{@link trigger }\`.
1519 *
1520 * **Cause**: The `.on()` and `.trigger()` methods can set an event handler or generate an event for any event type, and should be used instead of the shortcut methods. This message also applies to the other event shorthands, including: blur, focus, focusin, focusout, resize, scroll, dblclick, mousedown, mouseup, mousemove, mouseover, mouseout, mouseenter, mouseleave, change, select, submit, keydown, keypress, keyup, and contextmenu.
1521 *
1522 * **Solution**: Instead of `.click(fn)` use `.on("click", fn)`. Instead of `.click()` use `.trigger("click")`.
1523 */
1524 blur<TData>(eventData: TData,
1525 handler: JQuery.TypeEventHandler<TElement, TData, TElement, TElement, 'blur'>): this;
1526 /**
1527 * Bind an event handler to the "blur" JavaScript event, or trigger that event on an element.
1528 * @param handler A function to execute each time the event is triggered.
1529 * @see \`{@link https://api.jquery.com/blur/ }\`
1530 * @since 1.0
1531 * @deprecated ​ Deprecated since 3.3. Use \`{@link on }\` or \`{@link trigger }\`.
1532 *
1533 * **Cause**: The `.on()` and `.trigger()` methods can set an event handler or generate an event for any event type, and should be used instead of the shortcut methods. This message also applies to the other event shorthands, including: blur, focus, focusin, focusout, resize, scroll, dblclick, mousedown, mouseup, mousemove, mouseover, mouseout, mouseenter, mouseleave, change, select, submit, keydown, keypress, keyup, and contextmenu.
1534 *
1535 * **Solution**: Instead of `.click(fn)` use `.on("click", fn)`. Instead of `.click()` use `.trigger("click")`.
1536 * @example ​ ````To trigger the blur event on all paragraphs:
1537```javascript
1538$( "p" ).blur();
1539```
1540 */
1541 blur(handler?: JQuery.TypeEventHandler<TElement, null, TElement, TElement, 'blur'> |
1542 false): this;
1543 /**
1544 * Bind an event handler to the "change" JavaScript event, or trigger that event on an element.
1545 * @param eventData An object containing data that will be passed to the event handler.
1546 * @param handler A function to execute each time the event is triggered.
1547 * @see \`{@link https://api.jquery.com/change/ }\`
1548 * @since 1.4.3
1549 * @deprecated ​ Deprecated since 3.3. Use \`{@link on }\` or \`{@link trigger }\`.
1550 *
1551 * **Cause**: The `.on()` and `.trigger()` methods can set an event handler or generate an event for any event type, and should be used instead of the shortcut methods. This message also applies to the other event shorthands, including: blur, focus, focusin, focusout, resize, scroll, dblclick, mousedown, mouseup, mousemove, mouseover, mouseout, mouseenter, mouseleave, change, select, submit, keydown, keypress, keyup, and contextmenu.
1552 *
1553 * **Solution**: Instead of `.click(fn)` use `.on("click", fn)`. Instead of `.click()` use `.trigger("click")`.
1554 */
1555 change<TData>(eventData: TData,
1556 handler: JQuery.TypeEventHandler<TElement, TData, TElement, TElement, 'change'>): this;
1557 /**
1558 * Bind an event handler to the "change" JavaScript event, or trigger that event on an element.
1559 * @param handler A function to execute each time the event is triggered.
1560 * @see \`{@link https://api.jquery.com/change/ }\`
1561 * @since 1.0
1562 * @deprecated ​ Deprecated since 3.3. Use \`{@link on }\` or \`{@link trigger }\`.
1563 *
1564 * **Cause**: The `.on()` and `.trigger()` methods can set an event handler or generate an event for any event type, and should be used instead of the shortcut methods. This message also applies to the other event shorthands, including: blur, focus, focusin, focusout, resize, scroll, dblclick, mousedown, mouseup, mousemove, mouseover, mouseout, mouseenter, mouseleave, change, select, submit, keydown, keypress, keyup, and contextmenu.
1565 *
1566 * **Solution**: Instead of `.click(fn)` use `.on("click", fn)`. Instead of `.click()` use `.trigger("click")`.
1567 * @example ​ ````Attaches a change event to the select that gets the text for each selected option and writes them in the div. It then triggers the event for the initial text draw.
1568```html
1569<!doctype html>
1570<html lang="en">
1571<head>
1572 <meta charset="utf-8">
1573 <title>change demo</title>
1574 <style>
1575 div {
1576 color: red;
1577 }
1578 </style>
1579 <script src="https://code.jquery.com/jquery-3.3.1.js"></script>
1580</head>
1581<body>
1582
1583<select name="sweets" multiple="multiple">
1584 <option>Chocolate</option>
1585 <option selected="selected">Candy</option>
1586 <option>Taffy</option>
1587 <option selected="selected">Caramel</option>
1588 <option>Fudge</option>
1589 <option>Cookie</option>
1590</select>
1591<div></div>
1592
1593<script>
1594$( "select" )
1595 .change(function () {
1596 var str = "";
1597 $( "select option:selected" ).each(function() {
1598 str += $( this ).text() + " ";
1599 });
1600 $( "div" ).text( str );
1601 })
1602 .change();
1603</script>
1604
1605</body>
1606</html>
1607```
1608 * @example ​ ````To add a validity test to all text input elements:
1609```javascript
1610$( "input[type='text']" ).change(function() {
1611 // Check input( $( this ).val() ) for validity here
1612});
1613```
1614 */
1615 change(handler?: JQuery.TypeEventHandler<TElement, null, TElement, TElement, 'change'> |
1616 false): this;
1617 /**
1618 * Get the children of each element in the set of matched elements, optionally filtered by a selector.
1619 * @param selector A string containing a selector expression to match elements against.
1620 * @see \`{@link https://api.jquery.com/children/ }\`
1621 * @since 1.0
1622 * @example ​ ````Find all children of the clicked element.
1623```html
1624<!doctype html>
1625<html lang="en">
1626<head>
1627 <meta charset="utf-8">
1628 <title>children demo</title>
1629 <style>
1630 body {
1631 font-size: 16px;
1632 font-weight: bolder;
1633 }
1634 div {
1635 width: 130px;
1636 height: 82px;
1637 margin: 10px;
1638 float: left;
1639 border: 1px solid blue;
1640 padding: 4px;
1641 }
1642 #container {
1643 width: auto;
1644 height: 105px;
1645 margin: 0;
1646 float: none;
1647 border: none;
1648 }
1649 .hilite {
1650 border-color: red;
1651 }
1652 #results {
1653 display: block;
1654 color: red;
1655 }
1656 p, span, em, a, b, button {
1657 border: 1px solid transparent;
1658 }
1659 p {
1660 margin: 10px;
1661 }
1662 span {
1663 color: blue;
1664 }
1665 input {
1666 width: 100px;
1667 }
1668 </style>
1669 <script src="https://code.jquery.com/jquery-3.3.1.js"></script>
1670</head>
1671<body>
1672
1673<div id="container">
1674 <div>
1675 <p>This <span>is the <em>way</em> we</span>
1676 write <em>the</em> demo,</p>
1677 </div>
1678
1679 <div>
1680 <a href="#"><b>w</b>rit<b>e</b></a> the <span>demo,</span> <button>write
1681 the</button> demo,
1682 </div>
1683
1684 <div>
1685 This <span>the way we <em>write</em> the <em>demo</em> so</span>
1686 <input type="text" value="early"> in
1687 </div>
1688
1689 <p>
1690 <span>t</span>he <span>m</span>orning.
1691 <span id="results">Found <span>0</span> children in <span>TAG</span>.</span>
1692 </p>
1693</div>
1694
1695<script>
1696$( "#container" ).click(function ( event ) {
1697 $( "*" ).removeClass( "hilite" );
1698 var kids = $( event.target ).children();
1699 var len = kids.addClass( "hilite" ).length;
1700
1701 $( "#results span:first" ).text( len );
1702 $( "#results span:last" ).text( event.target.tagName );
1703
1704 event.preventDefault();
1705});
1706</script>
1707
1708</body>
1709</html>
1710```
1711 * @example ​ ````Find all children of each div.
1712```html
1713<!doctype html>
1714<html lang="en">
1715<head>
1716 <meta charset="utf-8">
1717 <title>children demo</title>
1718 <style>
1719 body {
1720 font-size: 16px;
1721 font-weight: bolder;
1722 }
1723 span {
1724 color: blue;
1725 }
1726 p {
1727 margin: 5px 0;
1728 }
1729 </style>
1730 <script src="https://code.jquery.com/jquery-3.3.1.js"></script>
1731</head>
1732<body>
1733
1734<p>Hello (this is a paragraph)</p>
1735
1736<div><span>Hello Again (this span is a child of the a div)</span></div>
1737<p>And <span>Again</span> (in another paragraph)</p>
1738
1739<div>And One Last <span>Time</span> (most text directly in a div)</div>
1740
1741<script>
1742$( "div" ).children().css( "border-bottom", "3px double red" );
1743</script>
1744
1745</body>
1746</html>
1747```
1748 * @example ​ ````Find all children with a class &quot;selected&quot; of each div.
1749```html
1750<!doctype html>
1751<html lang="en">
1752<head>
1753 <meta charset="utf-8">
1754 <title>children demo</title>
1755 <style>
1756 body {
1757 font-size: 16px;
1758 font-weight: bolder;
1759 }
1760 p {
1761 margin: 5px 0;
1762 }
1763 </style>
1764 <script src="https://code.jquery.com/jquery-3.3.1.js"></script>
1765</head>
1766<body>
1767
1768<div>
1769 <span>Hello</span>
1770 <p class="selected">Hello Again</p>
1771 <div class="selected">And Again</div>
1772 <p>And One Last Time</p>
1773</div>
1774
1775<script>
1776$( "div" ).children( ".selected" ).css( "color", "blue" );
1777</script>
1778
1779</body>
1780</html>
1781```
1782 */
1783 children(selector?: JQuery.Selector): this;
1784 /**
1785 * Remove from the queue all items that have not yet been run.
1786 * @param queueName A string containing the name of the queue. Defaults to fx, the standard effects queue.
1787 * @see \`{@link https://api.jquery.com/clearQueue/ }\`
1788 * @since 1.4
1789 * @example ​ ````Empty the queue.
1790```html
1791<!doctype html>
1792<html lang="en">
1793<head>
1794 <meta charset="utf-8">
1795 <title>clearQueue demo</title>
1796 <style>
1797 div {
1798 margin: 3px;
1799 width: 40px;
1800 height: 40px;
1801 position: absolute;
1802 left: 0px;
1803 top: 30px;
1804 background: green;
1805 display: none;
1806 }
1807 div.newcolor {
1808 background: blue;
1809 }
1810 </style>
1811 <script src="https://code.jquery.com/jquery-3.3.1.js"></script>
1812</head>
1813<body>
1814
1815<button id="start">Start</button>
1816<button id="stop">Stop</button>
1817<div></div>
1818
1819<script>
1820$( "#start" ).click(function() {
1821 var myDiv = $( "div" );
1822 myDiv.show( "slow" );
1823 myDiv.animate({
1824 left:"+=200"
1825 }, 5000 );
1826
1827 myDiv.queue(function() {
1828 var that = $( this );
1829 that.addClass( "newcolor" );
1830 that.dequeue();
1831 });
1832
1833 myDiv.animate({
1834 left:"-=200"
1835 }, 1500 );
1836 myDiv.queue(function() {
1837 var that = $( this );
1838 that.removeClass( "newcolor" );
1839 that.dequeue();
1840 });
1841 myDiv.slideUp();
1842});
1843
1844$( "#stop" ).click(function() {
1845 var myDiv = $( "div" );
1846 myDiv.clearQueue();
1847 myDiv.stop();
1848});
1849</script>
1850
1851</body>
1852</html>
1853```
1854 */
1855 clearQueue(queueName?: string): this;
1856 /**
1857 * Bind an event handler to the "click" JavaScript event, or trigger that event on an element.
1858 * @param eventData An object containing data that will be passed to the event handler.
1859 * @param handler A function to execute each time the event is triggered.
1860 * @see \`{@link https://api.jquery.com/click/ }\`
1861 * @since 1.4.3
1862 * @deprecated ​ Deprecated since 3.3. Use \`{@link on }\` or \`{@link trigger }\`.
1863 *
1864 * **Cause**: The `.on()` and `.trigger()` methods can set an event handler or generate an event for any event type, and should be used instead of the shortcut methods. This message also applies to the other event shorthands, including: blur, focus, focusin, focusout, resize, scroll, dblclick, mousedown, mouseup, mousemove, mouseover, mouseout, mouseenter, mouseleave, change, select, submit, keydown, keypress, keyup, and contextmenu.
1865 *
1866 * **Solution**: Instead of `.click(fn)` use `.on("click", fn)`. Instead of `.click()` use `.trigger("click")`.
1867 */
1868 click<TData>(eventData: TData,
1869 handler: JQuery.TypeEventHandler<TElement, TData, TElement, TElement, 'click'>): this;
1870 /**
1871 * Bind an event handler to the "click" JavaScript event, or trigger that event on an element.
1872 * @param handler A function to execute each time the event is triggered.
1873 * @see \`{@link https://api.jquery.com/click/ }\`
1874 * @since 1.0
1875 * @deprecated ​ Deprecated since 3.3. Use \`{@link on }\` or \`{@link trigger }\`.
1876 *
1877 * **Cause**: The `.on()` and `.trigger()` methods can set an event handler or generate an event for any event type, and should be used instead of the shortcut methods. This message also applies to the other event shorthands, including: blur, focus, focusin, focusout, resize, scroll, dblclick, mousedown, mouseup, mousemove, mouseover, mouseout, mouseenter, mouseleave, change, select, submit, keydown, keypress, keyup, and contextmenu.
1878 *
1879 * **Solution**: Instead of `.click(fn)` use `.on("click", fn)`. Instead of `.click()` use `.trigger("click")`.
1880 * @example ​ ````Hide paragraphs on a page when they are clicked:
1881```html
1882<!doctype html>
1883<html lang="en">
1884<head>
1885 <meta charset="utf-8">
1886 <title>click demo</title>
1887 <style>
1888 p {
1889 color: red;
1890 margin: 5px;
1891 cursor: pointer;
1892 }
1893 p:hover {
1894 background: yellow;
1895 }
1896 </style>
1897 <script src="https://code.jquery.com/jquery-3.3.1.js"></script>
1898</head>
1899<body>
1900
1901<p>First Paragraph</p>
1902<p>Second Paragraph</p>
1903<p>Yet one more Paragraph</p>
1904
1905<script>
1906$( "p" ).click(function() {
1907 $( this ).slideUp();
1908});
1909</script>
1910
1911</body>
1912</html>
1913```
1914 * @example ​ ````Trigger the click event on all of the paragraphs on the page:
1915```javascript
1916$( "p" ).click();
1917```
1918 */
1919 click(handler?: JQuery.TypeEventHandler<TElement, null, TElement, TElement, 'click'> |
1920 false): this;
1921 /**
1922 * Create a deep copy of the set of matched elements.
1923 * @param withDataAndEvents A Boolean indicating whether event handlers and data should be copied along with the elements. The
1924 * default value is false. *In jQuery 1.5.0 the default value was incorrectly true; it was changed back
1925 * to false in 1.5.1 and up.
1926 * @param deepWithDataAndEvents A Boolean indicating whether event handlers and data for all children of the cloned element should
1927 * be copied. By default its value matches the first argument's value (which defaults to false).
1928 * @see \`{@link https://api.jquery.com/clone/ }\`
1929 * @since 1.0
1930 * @since 1.5
1931 * @example ​ ````Clones all b elements (and selects the clones) and prepends them to all paragraphs.
1932```html
1933<!doctype html>
1934<html lang="en">
1935<head>
1936 <meta charset="utf-8">
1937 <title>clone demo</title>
1938 <script src="https://code.jquery.com/jquery-3.3.1.js"></script>
1939</head>
1940<body>
1941
1942<b>Hello</b><p>, how are you?</p>
1943
1944<script>
1945$( "b" ).clone().prependTo( "p" );
1946</script>
1947
1948</body>
1949</html>
1950```
1951 */
1952 clone(withDataAndEvents?: boolean, deepWithDataAndEvents?: boolean): this;
1953 /**
1954 * For each element in the set, get the first element that matches the selector by testing the element itself and traversing up through its ancestors in the DOM tree.
1955 * @param selector A string containing a selector expression to match elements against.
1956 * @param context A DOM element within which a matching element may be found.
1957 * @see \`{@link https://api.jquery.com/closest/ }\`
1958 * @since 1.4
1959 */
1960 closest(selector: JQuery.Selector, context: Element): this;
1961 /**
1962 * For each element in the set, get the first element that matches the selector by testing the element itself and traversing up through its ancestors in the DOM tree.
1963 * @param selector_selection_element _&#x40;param_ `selector_selection_element`
1964 * <br>
1965 * * `selector` — A string containing a selector expression to match elements against. <br>
1966 * * `selection` — A jQuery object to match elements against. <br>
1967 * * `element` — An element to match elements against.
1968 * @see \`{@link https://api.jquery.com/closest/ }\`
1969 * @since 1.3
1970 * @since 1.6
1971 * @example ​ ````Show how event delegation can be done with closest. The closest list element toggles a yellow background when it or its descendent is clicked.
1972```html
1973<!doctype html>
1974<html lang="en">
1975<head>
1976 <meta charset="utf-8">
1977 <title>closest demo</title>
1978 <style>
1979 li {
1980 margin: 3px;
1981 padding: 3px;
1982 background: #EEEEEE;
1983 }
1984 li.highlight {
1985 background: yellow;
1986 }
1987 </style>
1988 <script src="https://code.jquery.com/jquery-3.3.1.js"></script>
1989</head>
1990<body>
1991
1992<ul>
1993 <li><b>Click me!</b></li>
1994 <li>You can also <b>Click me!</b></li>
1995</ul>
1996
1997<script>
1998$( document ).on( "click", function( event ) {
1999 $( event.target ).closest( "li" ).toggleClass( "highlight" );
2000});
2001</script>
2002
2003</body>
2004</html>
2005```
2006 * @example ​ ````Pass a jQuery object to closest. The closest list element toggles a yellow background when it or its descendent is clicked.
2007```html
2008<!doctype html>
2009<html lang="en">
2010<head>
2011 <meta charset="utf-8">
2012 <title>closest demo</title>
2013 <style>
2014 li {
2015 margin: 3px;
2016 padding: 3px;
2017 background: #EEEEEE;
2018 }
2019 li.highlight {
2020 background: yellow;
2021 }
2022 </style>
2023 <script src="https://code.jquery.com/jquery-3.3.1.js"></script>
2024</head>
2025<body>
2026
2027<ul>
2028 <li><b>Click me!</b></li>
2029 <li>You can also <b>Click me!</b></li>
2030</ul>
2031
2032<script>
2033var listElements = $( "li" ).css( "color", "blue" );
2034$( document ).on( "click", function( event ) {
2035 $( event.target ).closest( listElements ).toggleClass( "highlight" );
2036});
2037</script>
2038
2039</body>
2040</html>
2041```
2042 */
2043 closest(selector_selection_element: JQuery.Selector | Element | JQuery): this;
2044 /**
2045 * Get the children of each element in the set of matched elements, including text and comment nodes.
2046 * @see \`{@link https://api.jquery.com/contents/ }\`
2047 * @since 1.2
2048 * @example ​ ````Find all the text nodes inside a paragraph and wrap them with a bold tag.
2049```html
2050<!doctype html>
2051<html lang="en">
2052<head>
2053 <meta charset="utf-8">
2054 <title>contents demo</title>
2055 <script src="https://code.jquery.com/jquery-3.3.1.js"></script>
2056</head>
2057<body>
2058
2059<p>Hello <a href="https://johnresig.com/">John</a>, how are you doing?</p>
2060
2061<script>
2062$( "p" )
2063 .contents()
2064 .filter(function(){
2065 return this.nodeType !== 1;
2066 })
2067 .wrap( "<b></b>" );
2068</script>
2069
2070</body>
2071</html>
2072```
2073 * @example ​ ````Change the background color of links inside of an iframe.
2074```html
2075<!doctype html>
2076<html lang="en">
2077<head>
2078 <meta charset="utf-8">
2079 <title>contents demo</title>
2080 <script src="https://code.jquery.com/jquery-3.3.1.js"></script>
2081</head>
2082<body>
2083
2084<iframe src="https://api.jquery.com/" width="80%" height="600" id="frameDemo"></iframe>
2085
2086<script>
2087$( "#frameDemo" ).contents().find( "a" ).css( "background-color", "#BADA55" );
2088</script>
2089
2090</body>
2091</html>
2092```
2093 */
2094 contents(): JQuery<TElement | Text | Comment | Document>;
2095 /**
2096 * Bind an event handler to the "contextmenu" JavaScript event, or trigger that event on an element.
2097 * @param eventData An object containing data that will be passed to the event handler.
2098 * @param handler A function to execute each time the event is triggered.
2099 * @see \`{@link https://api.jquery.com/contextmenu/ }\`
2100 * @since 1.4.3
2101 * @deprecated ​ Deprecated since 3.3. Use \`{@link on }\` or \`{@link trigger }\`.
2102 *
2103 * **Cause**: The `.on()` and `.trigger()` methods can set an event handler or generate an event for any event type, and should be used instead of the shortcut methods. This message also applies to the other event shorthands, including: blur, focus, focusin, focusout, resize, scroll, dblclick, mousedown, mouseup, mousemove, mouseover, mouseout, mouseenter, mouseleave, change, select, submit, keydown, keypress, keyup, and contextmenu.
2104 *
2105 * **Solution**: Instead of `.click(fn)` use `.on("click", fn)`. Instead of `.click()` use `.trigger("click")`.
2106 */
2107 contextmenu<TData>(eventData: TData,
2108 handler: JQuery.TypeEventHandler<TElement, TData, TElement, TElement, 'contextmenu'>): this;
2109 /**
2110 * Bind an event handler to the "contextmenu" JavaScript event, or trigger that event on an element.
2111 * @param handler A function to execute each time the event is triggered.
2112 * @see \`{@link https://api.jquery.com/contextmenu/ }\`
2113 * @since 1.0
2114 * @deprecated ​ Deprecated since 3.3. Use \`{@link on }\` or \`{@link trigger }\`.
2115 *
2116 * **Cause**: The `.on()` and `.trigger()` methods can set an event handler or generate an event for any event type, and should be used instead of the shortcut methods. This message also applies to the other event shorthands, including: blur, focus, focusin, focusout, resize, scroll, dblclick, mousedown, mouseup, mousemove, mouseover, mouseout, mouseenter, mouseleave, change, select, submit, keydown, keypress, keyup, and contextmenu.
2117 *
2118 * **Solution**: Instead of `.click(fn)` use `.on("click", fn)`. Instead of `.click()` use `.trigger("click")`.
2119 * @example ​ ````To show a &quot;Hello World!&quot; alert box when the contextmenu event is triggered on a paragraph on the page:
2120```javascript
2121$( "p" ).contextmenu(function() {
2122 alert( "Hello World!" );
2123});
2124```
2125 * @example ​ ````Right click to toggle background color.
2126```html
2127<!doctype html>
2128<html lang="en">
2129<head>
2130 <meta charset="utf-8">
2131 <title>contextmenu demo</title>
2132 <style>
2133 div {
2134 background: blue;
2135 color: white;
2136 height: 100px;
2137 width: 150px;
2138 }
2139 div.contextmenu {
2140 background: yellow;
2141 color: black;
2142 }
2143 </style>
2144 <script src="https://code.jquery.com/jquery-3.3.1.js"></script>
2145</head>
2146<body>
2147
2148<div></div>
2149<span>Right click the block</span>
2150
2151<script>
2152var div = $( "div:first" );
2153div.contextmenu(function() {
2154 div.toggleClass( "contextmenu" );
2155});
2156</script>
2157
2158</body>
2159</html>
2160```
2161 */
2162 contextmenu(handler?: JQuery.TypeEventHandler<TElement, null, TElement, TElement, 'contextmenu'> |
2163 false): this;
2164 /**
2165 * Set one or more CSS properties for the set of matched elements.
2166 * @param propertyName A CSS property name.
2167 * @param value_function _&#x40;param_ `value_function`
2168 * <br>
2169 * * `value` — A value to set for the property. <br>
2170 * * `function` — A function returning the value to set. `this` is the current element. Receives the index position of
2171 * the element in the set and the old value as arguments.
2172 * @see \`{@link https://api.jquery.com/css/ }\`
2173 * @since 1.0
2174 * @since 1.4
2175 * @example ​ ````Change the color of any paragraph to red on mouseover event.
2176```html
2177<!doctype html>
2178<html lang="en">
2179<head>
2180 <meta charset="utf-8">
2181 <title>css demo</title>
2182 <style>
2183 p {
2184 color: blue;
2185 width: 200px;
2186 font-size: 14px;
2187 }
2188 </style>
2189 <script src="https://code.jquery.com/jquery-3.3.1.js"></script>
2190</head>
2191<body>
2192
2193 <p>Just roll the mouse over me.</p>
2194
2195 <p>Or me to see a color change.</p>
2196
2197<script>
2198$( "p" ).on( "mouseover", function() {
2199 $( this ).css( "color", "red" );
2200});
2201</script>
2202
2203</body>
2204</html>
2205```
2206 * @example ​ ````Increase the width of #box by 200 pixels the first time it is clicked.
2207```html
2208<!doctype html>
2209<html lang="en">
2210<head>
2211 <meta charset="utf-8">
2212 <title>css demo</title>
2213 <style>
2214 #box {
2215 background: black;
2216 color: snow;
2217 width: 100px;
2218 padding: 10px;
2219 }
2220 </style>
2221 <script src="https://code.jquery.com/jquery-3.3.1.js"></script>
2222</head>
2223<body>
2224
2225<div id="box">Click me to grow</div>
2226
2227<script>
2228$( "#box" ).one( "click", function() {
2229 $( this ).css( "width", "+=200" );
2230});
2231</script>
2232
2233</body>
2234</html>
2235```
2236 * @example ​ ````Highlight a clicked word in the paragraph.
2237```html
2238<!doctype html>
2239<html lang="en">
2240<head>
2241 <meta charset="utf-8">
2242 <title>css demo</title>
2243 <style>
2244 p {
2245 color: blue;
2246 font-weight: bold;
2247 cursor: pointer;
2248 }
2249 </style>
2250 <script src="https://code.jquery.com/jquery-3.3.1.js"></script>
2251</head>
2252<body>
2253
2254<p>
2255 Once upon a time there was a man
2256 who lived in a pizza parlor. This
2257 man just loved pizza and ate it all
2258 the time. He went on to be the
2259 happiest man in the world. The end.
2260</p>
2261
2262<script>
2263var words = $( "p" ).first().text().split( /\s+/ );
2264var text = words.join( "</span> <span>" );
2265$( "p" ).first().html( "<span>" + text + "</span>" );
2266$( "span" ).on( "click", function() {
2267 $( this ).css( "background-color", "yellow" );
2268});
2269</script>
2270
2271</body>
2272</html>
2273```
2274 */
2275 css(propertyName: string,
2276 value_function: string | number | ((this: TElement, index: number, value: string) => string | number | void | undefined)): this;
2277 /**
2278 * Set one or more CSS properties for the set of matched elements.
2279 * @param properties An object of property-value pairs to set.
2280 * @see \`{@link https://api.jquery.com/css/ }\`
2281 * @since 1.0
2282 * @example ​ ````Change the font weight and background color on mouseenter and mouseleave.
2283```html
2284<!doctype html>
2285<html lang="en">
2286<head>
2287 <meta charset="utf-8">
2288 <title>css demo</title>
2289 <style>
2290 p {
2291 color: green;
2292 }
2293 </style>
2294 <script src="https://code.jquery.com/jquery-3.3.1.js"></script>
2295</head>
2296<body>
2297
2298<p>Move the mouse over a paragraph.</p>
2299<p>Like this one or the one above.</p>
2300
2301<script>
2302$( "p" )
2303 .on( "mouseenter", function() {
2304 $( this ).css({
2305 "background-color": "yellow",
2306 "font-weight": "bolder"
2307 });
2308 })
2309 .on( "mouseleave", function() {
2310 var styles = {
2311 backgroundColor : "#ddd",
2312 fontWeight: ""
2313 };
2314 $( this ).css( styles );
2315 });
2316</script>
2317
2318</body>
2319</html>
2320```
2321 * @example ​ ````Increase the size of a div when you click it.
2322```html
2323<!doctype html>
2324<html lang="en">
2325<head>
2326 <meta charset="utf-8">
2327 <title>css demo</title>
2328 <style>
2329 div {
2330 width: 20px;
2331 height: 15px;
2332 background-color: #f33;
2333 }
2334 </style>
2335 <script src="https://code.jquery.com/jquery-3.3.1.js"></script>
2336</head>
2337<body>
2338
2339<div>click</div>
2340<div>click</div>
2341
2342<script>
2343$( "div" ).on( "click", function() {
2344 $( this ).css({
2345 width: function( index, value ) {
2346 return parseFloat( value ) * 1.2;
2347 },
2348 height: function( index, value ) {
2349 return parseFloat( value ) * 1.2;
2350 }
2351 });
2352});
2353</script>
2354
2355</body>
2356</html>
2357```
2358 */
2359 css(properties: JQuery.PlainObject<string | number | ((this: TElement, index: number, value: string) => string | number | void | undefined)>): this;
2360 /**
2361 * Get the computed style properties for the first element in the set of matched elements.
2362 * @param propertyName A CSS property.
2363 * @see \`{@link https://api.jquery.com/css/ }\`
2364 * @since 1.0
2365 * @example ​ ````Get the background color of a clicked div.
2366```html
2367<!doctype html>
2368<html lang="en">
2369<head>
2370 <meta charset="utf-8">
2371 <title>css demo</title>
2372 <style>
2373 div {
2374 width: 60px;
2375 height: 60px;
2376 margin: 5px;
2377 float: left;
2378 }
2379 </style>
2380 <script src="https://code.jquery.com/jquery-3.3.1.js"></script>
2381</head>
2382<body>
2383
2384<span id="result">&nbsp;</span>
2385<div style="background-color:blue;"></div>
2386<div style="background-color:rgb(15,99,30);"></div>
2387<div style="background-color:#123456;"></div>
2388<div style="background-color:#f11;"></div>
2389
2390<script>
2391$( "div" ).click(function() {
2392 var color = $( this ).css( "background-color" );
2393 $( "#result" ).html( "That div is <span style='color:" +
2394 color + ";'>" + color + "</span>." );
2395});
2396</script>
2397
2398</body>
2399</html>
2400```
2401 */
2402 css(propertyName: string): string;
2403 /**
2404 * Get the computed style properties for the first element in the set of matched elements.
2405 * @param propertyNames An array of one or more CSS properties.
2406 * @see \`{@link https://api.jquery.com/css/ }\`
2407 * @since 1.9
2408 * @example ​ ````Get the width, height, text color, and background color of a clicked div.
2409```html
2410<!doctype html>
2411<html lang="en">
2412<head>
2413 <meta charset="utf-8">
2414 <title>css demo</title>
2415 <style>
2416 div {
2417 height: 50px;
2418 margin: 5px;
2419 padding: 5px;
2420 float: left;
2421 }
2422 #box1 {
2423 width: 50px;
2424 color: yellow;
2425 background-color: blue;
2426 }
2427 #box2 {
2428 width: 80px;
2429 color: rgb(255, 255, 255);
2430 background-color: rgb(15, 99, 30);
2431 }
2432 #box3 {
2433 width: 40px;
2434 color: #fcc;
2435 background-color: #123456;
2436 }
2437 #box4 {
2438 width: 70px;
2439 background-color: #f11;
2440 }
2441 </style>
2442 <script src="https://code.jquery.com/jquery-3.3.1.js"></script>
2443</head>
2444<body>
2445
2446<p id="result">&nbsp;</p>
2447<div id="box1">1</div>
2448<div id="box2">2</div>
2449<div id="box3">3</div>
2450<div id="box4">4</div>
2451
2452<script>
2453$( "div" ).click(function() {
2454 var html = [ "The clicked div has the following styles:" ];
2455
2456 var styleProps = $( this ).css([
2457 "width", "height", "color", "background-color"
2458 ]);
2459 $.each( styleProps, function( prop, value ) {
2460 html.push( prop + ": " + value );
2461 });
2462
2463 $( "#result" ).html( html.join( "<br>" ) );
2464});
2465</script>
2466
2467</body>
2468</html>
2469```
2470 */
2471 css(propertyNames: string[]): JQuery.PlainObject<string>;
2472 /**
2473 * Store arbitrary data associated with the matched elements.
2474 * @param key A string naming the piece of data to set.
2475 * @param value The new data value; this can be any Javascript type except `undefined`.
2476 * @see \`{@link https://api.jquery.com/data/ }\`
2477 * @since 1.2.3
2478 * @example ​ ````Store then retrieve a value from the div element.
2479```html
2480<!doctype html>
2481<html lang="en">
2482<head>
2483 <meta charset="utf-8">
2484 <title>data demo</title>
2485 <style>
2486 div {
2487 color: blue;
2488 }
2489 span {
2490 color: red;
2491 }
2492 </style>
2493 <script src="https://code.jquery.com/jquery-3.3.1.js"></script>
2494</head>
2495<body>
2496
2497<div>
2498 The values stored were
2499 <span></span>
2500 and
2501 <span></span>
2502</div>
2503
2504<script>
2505$( "div" ).data( "test", { first: 16, last: "pizza!" } );
2506$( "span:first" ).text( $( "div" ).data( "test" ).first );
2507$( "span:last" ).text( $( "div" ).data( "test" ).last );
2508</script>
2509
2510</body>
2511</html>
2512```
2513 */
2514 data(key: string, value: string | number | boolean | symbol | object | null): this;
2515 /**
2516 * Store arbitrary data associated with the matched elements.
2517 * @param obj An object of key-value pairs of data to update.
2518 * @see \`{@link https://api.jquery.com/data/ }\`
2519 * @since 1.4.3
2520 */
2521 data(obj: JQuery.PlainObject): this;
2522 /**
2523 * Return the value at the named data store for the first element in the jQuery collection, as set by data(name, value) or by an HTML5 data-* attribute.
2524 * @param key Name of the data stored.
2525 * @param value `undefined` is not recognized as a data value. Calls such as `.data( "name", undefined )`
2526 * will return the jQuery object that it was called on, allowing for chaining.
2527 * @see \`{@link https://api.jquery.com/data/ }\`
2528 * @since 1.2.3
2529 */
2530 // `unified-signatures` is disabled so that behavior when passing `undefined` to `value` can be documented. Unifying the signatures
2531 // results in potential confusion for users from an unexpected parameter.
2532 // tslint:disable-next-line:unified-signatures
2533 data(key: string, value: undefined): any;
2534 /**
2535 * Return the value at the named data store for the first element in the jQuery collection, as set by data(name, value) or by an HTML5 data-* attribute.
2536 * @param key Name of the data stored.
2537 * @see \`{@link https://api.jquery.com/data/ }\`
2538 * @since 1.2.3
2539 * @example ​ ````Get the data named &quot;blah&quot; stored at for an element.
2540```html
2541<!doctype html>
2542<html lang="en">
2543<head>
2544 <meta charset="utf-8">
2545 <title>data demo</title>
2546 <style>
2547 div {
2548 margin: 5px;
2549 background: yellow;
2550 }
2551 button {
2552 margin: 5px;
2553 font-size: 14px;
2554 }
2555 p {
2556 margin: 5px;
2557 color: blue;
2558 }
2559 span {
2560 color: red;
2561 }
2562 </style>
2563 <script src="https://code.jquery.com/jquery-3.3.1.js"></script>
2564</head>
2565<body>
2566
2567<div>A div</div>
2568<button>Get "blah" from the div</button>
2569<button>Set "blah" to "hello"</button>
2570<button>Set "blah" to 86</button>
2571<button>Remove "blah" from the div</button>
2572<p>The "blah" value of this div is <span>?</span></p>
2573
2574<script>
2575$( "button" ).click(function() {
2576 var value;
2577
2578 switch ( $( "button" ).index( this ) ) {
2579 case 0 :
2580 value = $( "div" ).data( "blah" );
2581 break;
2582 case 1 :
2583 $( "div" ).data( "blah", "hello" );
2584 value = "Stored!";
2585 break;
2586 case 2 :
2587 $( "div" ).data( "blah", 86 );
2588 value = "Stored!";
2589 break;
2590 case 3 :
2591 $( "div" ).removeData( "blah" );
2592 value = "Removed!";
2593 break;
2594 }
2595
2596 $( "span" ).text( "" + value );
2597});
2598</script>
2599
2600</body>
2601</html>
2602```
2603 */
2604 data(key: string): any;
2605 /**
2606 * Return the value at the named data store for the first element in the jQuery collection, as set by data(name, value) or by an HTML5 data-* attribute.
2607 * @see \`{@link https://api.jquery.com/data/ }\`
2608 * @since 1.4
2609 */
2610 data(): JQuery.PlainObject;
2611 /**
2612 * Bind an event handler to the "dblclick" JavaScript event, or trigger that event on an element.
2613 * @param eventData An object containing data that will be passed to the event handler.
2614 * @param handler A function to execute each time the event is triggered.
2615 * @see \`{@link https://api.jquery.com/dblclick/ }\`
2616 * @since 1.4.3
2617 * @deprecatedDeprecated since 3.3. Use \`{@link on }\` or \`{@link trigger }\`.
2618 *
2619 * **Cause**: The `.on()` and `.trigger()` methods can set an event handler or generate an event for any event type, and should be used instead of the shortcut methods. This message also applies to the other event shorthands, including: blur, focus, focusin, focusout, resize, scroll, dblclick, mousedown, mouseup, mousemove, mouseover, mouseout, mouseenter, mouseleave, change, select, submit, keydown, keypress, keyup, and contextmenu.
2620 *
2621 * **Solution**: Instead of `.click(fn)` use `.on("click", fn)`. Instead of `.click()` use `.trigger("click")`.
2622 */
2623 dblclick<TData>(eventData: TData,
2624 handler: JQuery.TypeEventHandler<TElement, TData, TElement, TElement, 'dblclick'>): this;
2625 /**
2626 * Bind an event handler to the "dblclick" JavaScript event, or trigger that event on an element.
2627 * @param handler A function to execute each time the event is triggered.
2628 * @see \`{@link https://api.jquery.com/dblclick/ }\`
2629 * @since 1.0
2630 * @deprecatedDeprecated since 3.3. Use \`{@link on }\` or \`{@link trigger }\`.
2631 *
2632 * **Cause**: The `.on()` and `.trigger()` methods can set an event handler or generate an event for any event type, and should be used instead of the shortcut methods. This message also applies to the other event shorthands, including: blur, focus, focusin, focusout, resize, scroll, dblclick, mousedown, mouseup, mousemove, mouseover, mouseout, mouseenter, mouseleave, change, select, submit, keydown, keypress, keyup, and contextmenu.
2633 *
2634 * **Solution**: Instead of `.click(fn)` use `.on("click", fn)`. Instead of `.click()` use `.trigger("click")`.
2635 * @example ​ ````To bind a &quot;Hello World!&quot; alert box to the dblclick event on every paragraph on the page:
2636```javascript
2637$( "p" ).dblclick(function() {
2638 alert( "Hello World!" );
2639});
2640```
2641 * @example ​ ````Double click to toggle background color.
2642```html
2643<!doctype html>
2644<html lang="en">
2645<head>
2646 <meta charset="utf-8">
2647 <title>dblclick demo</title>
2648 <style>
2649 div {
2650 background: blue;
2651 color: white;
2652 height: 100px;
2653 width: 150px;
2654 }
2655 div.dbl {
2656 background: yellow;
2657 color: black;
2658 }
2659 </style>
2660 <script src="https://code.jquery.com/jquery-3.3.1.js"></script>
2661</head>
2662<body>
2663
2664<div></div>
2665<span>Double click the block</span>
2666
2667<script>
2668var divdbl = $( "div:first" );
2669divdbl.dblclick(function() {
2670 divdbl.toggleClass( "dbl" );
2671});
2672</script>
2673
2674</body>
2675</html>
2676```
2677 */
2678 dblclick(handler?: JQuery.TypeEventHandler<TElement, null, TElement, TElement, 'dblclick'> |
2679 false): this;
2680 /**
2681 * Set a timer to delay execution of subsequent items in the queue.
2682 * @param duration An integer indicating the number of milliseconds to delay execution of the next item in the queue.
2683 * @param queueName A string containing the name of the queue. Defaults to fx, the standard effects queue.
2684 * @see \`{@link https://api.jquery.com/delay/ }\`
2685 * @since 1.4
2686 * @example ​ ````Animate the hiding and showing of two divs, delaying the first before showing it.
2687```html
2688<!doctype html>
2689<html lang="en">
2690<head>
2691 <meta charset="utf-8">
2692 <title>delay demo</title>
2693 <style>
2694 div {
2695 position: absolute;
2696 width: 60px;
2697 height: 60px;
2698 float: left;
2699 }
2700 .first {
2701 background-color: #3f3;
2702 left: 0;
2703 }
2704 .second {
2705 background-color: #33f;
2706 left: 80px;
2707 }
2708 </style>
2709 <script src="https://code.jquery.com/jquery-3.3.1.js"></script>
2710</head>
2711<body>
2712
2713<p><button>Run</button></p>
2714<div class="first"></div>
2715<div class="second"></div>
2716
2717<script>
2718$( "button" ).click(function() {
2719 $( "div.first" ).slideUp( 300 ).delay( 800 ).fadeIn( 400 );
2720 $( "div.second" ).slideUp( 300 ).fadeIn( 400 );
2721});
2722</script>
2723
2724</body>
2725</html>
2726```
2727 */
2728 delay(duration: JQuery.Duration, queueName?: string): this;
2729 /**
2730 * Attach a handler to one or more events for all elements that match the selector, now or in the future, based on a specific set of root elements.
2731 * @param selector A selector to filter the elements that trigger the event.
2732 * @param eventType A string containing one or more space-separated JavaScript event types, such as "click" or
2733 * "keydown," or custom event names.
2734 * @param eventData An object containing data that will be passed to the event handler.
2735 * @param handler A function to execute each time the event is triggered.
2736 * @see \`{@link https://api.jquery.com/delegate/ }\`
2737 * @since 1.4.2
2738 * @deprecatedDeprecated since 3.0. Use \`{@link on }\`.
2739 *
2740 * **Cause**: These event binding methods have been deprecated in favor of the `.on()` and `.off()` methods which can handle both delegated and direct event binding. Although the older methods are still present in jQuery 3.0, they may be removed as early as the next major-version update.
2741 *
2742 * **Solution**: Change the method call to use `.on()` or `.off()`, the documentation for the old methods include specific instructions. In general, the `.bind()` and `.unbind()` methods can be renamed directly to `.on()` and `.off()` respectively since the argument orders are identical.
2743 */
2744 delegate<TType extends string,
2745 TData>(
2746 selector: JQuery.Selector,
2747 eventType: TType,
2748 eventData: TData,
2749 handler: JQuery.TypeEventHandler<TElement, TData, any, any, TType>
2750 ): this;
2751 /**
2752 * Attach a handler to one or more events for all elements that match the selector, now or in the future, based on a specific set of root elements.
2753 * @param selector A selector to filter the elements that trigger the event.
2754 * @param eventType A string containing one or more space-separated JavaScript event types, such as "click" or
2755 * "keydown," or custom event names.
2756 * @param handler A function to execute each time the event is triggered.
2757 * @see \`{@link https://api.jquery.com/delegate/ }\`
2758 * @since 1.4.2
2759 * @deprecatedDeprecated since 3.0. Use \`{@link on }\`.
2760 *
2761 * **Cause**: These event binding methods have been deprecated in favor of the `.on()` and `.off()` methods which can handle both delegated and direct event binding. Although the older methods are still present in jQuery 3.0, they may be removed as early as the next major-version update.
2762 *
2763 * **Solution**: Change the method call to use `.on()` or `.off()`, the documentation for the old methods include specific instructions. In general, the `.bind()` and `.unbind()` methods can be renamed directly to `.on()` and `.off()` respectively since the argument orders are identical.
2764 * @example ​ ````Click a paragraph to add another. Note that .delegate() attaches a click event handler to all paragraphs - even new ones.
2765```html
2766<!doctype html>
2767<html lang="en">
2768<head>
2769 <meta charset="utf-8">
2770 <title>delegate demo</title>
2771 <style>
2772 p {
2773 background: yellow;
2774 font-weight: bold;
2775 cursor: pointer;
2776 padding: 5px;
2777 }
2778 p.over {
2779 background: #ccc;
2780 }
2781 span {
2782 color: red;
2783 }
2784 </style>
2785 <script src="https://code.jquery.com/jquery-3.3.1.js"></script>
2786</head>
2787<body>
2788
2789<p>Click me!</p>
2790
2791<span></span>
2792
2793<script>
2794$( "body" ).delegate( "p", "click", function() {
2795 $( this ).after( "<p>Another paragraph!</p>" );
2796});
2797</script>
2798
2799</body>
2800</html>
2801```
2802 * @example ​ ````To display each paragraph&#39;s text in an alert box whenever it is clicked:
2803```javascript
2804$( "body" ).delegate( "p", "click", function() {
2805 alert( $( this ).text() );
2806});
2807```
2808 * @example ​ ````To cancel a default action and prevent it from bubbling up, return false:
2809```javascript
2810$( "body" ).delegate( "a", "click", function() {
2811 return false;
2812});
2813```
2814 * @example ​ ````To cancel only the default action by using the preventDefault method.
2815```javascript
2816$( "body" ).delegate( "a", "click", function( event ) {
2817 event.preventDefault();
2818});
2819```
2820 * @example ​ ````Can bind custom events too.
2821```html
2822<!doctype html>
2823<html lang="en">
2824<head>
2825 <meta charset="utf-8">
2826 <title>delegate demo</title>
2827 <style>
2828 p {
2829 color: red;
2830 }
2831 span {
2832 color: blue;
2833 }
2834 </style>
2835 <script src="https://code.jquery.com/jquery-3.3.1.js"></script>
2836</head>
2837<body>
2838
2839<p>Has an attached custom event.</p>
2840<button>Trigger custom event</button>
2841<span style="display:none;"></span>
2842
2843<script>
2844$( "body" ).delegate( "p", "myCustomEvent", function( e, myName, myValue ) {
2845 $( this ).text( "Hi there!" );
2846 $( "span" )
2847 .stop()
2848 .css( "opacity", 1 )
2849 .text( "myName = " + myName )
2850 .fadeIn( 30 )
2851 .fadeOut( 1000 );
2852});
2853$( "button" ).click(function() {
2854 $( "p" ).trigger( "myCustomEvent" );
2855});
2856</script>
2857
2858</body>
2859</html>
2860```
2861 */
2862 delegate<TType extends string>(
2863 selector: JQuery.Selector,
2864 eventType: TType,
2865 handler: JQuery.TypeEventHandler<TElement, undefined, any, any, TType> |
2866 false
2867 ): this;
2868 /**
2869 * Attach a handler to one or more events for all elements that match the selector, now or in the future, based on a specific set of root elements.
2870 * @param selector A selector to filter the elements that trigger the event.
2871 * @param events A plain object of one or more event types and functions to execute for them.
2872 * @see \`{@link https://api.jquery.com/delegate/ }\`
2873 * @since 1.4.3
2874 * @deprecatedDeprecated since 3.0. Use \`{@link on }\`.
2875 *
2876 * **Cause**: These event binding methods have been deprecated in favor of the `.on()` and `.off()` methods which can handle both delegated and direct event binding. Although the older methods are still present in jQuery 3.0, they may be removed as early as the next major-version update.
2877 *
2878 * **Solution**: Change the method call to use `.on()` or `.off()`, the documentation for the old methods include specific instructions. In general, the `.bind()` and `.unbind()` methods can be renamed directly to `.on()` and `.off()` respectively since the argument orders are identical.
2879 */
2880 delegate(selector: JQuery.Selector,
2881 events: JQuery.TypeEventHandlers<TElement, undefined, any, any>
2882 ): this;
2883 /**
2884 * Execute the next function on the queue for the matched elements.
2885 * @param queueName A string containing the name of the queue. Defaults to fx, the standard effects queue.
2886 * @see \`{@link https://api.jquery.com/dequeue/ }\`
2887 * @since 1.2
2888 * @example ​ ````Use dequeue to end a custom queue function which allows the queue to keep going.
2889```html
2890<!doctype html>
2891<html lang="en">
2892<head>
2893 <meta charset="utf-8">
2894 <title>dequeue demo</title>
2895 <style>
2896 div {
2897 margin: 3px;
2898 width: 50px;
2899 position: absolute;
2900 height: 50px;
2901 left: 10px;
2902 top: 30px;
2903 background-color: yellow;
2904 }
2905 div.red {
2906 background-color: red;
2907 }
2908 </style>
2909 <script src="https://code.jquery.com/jquery-3.3.1.js"></script>
2910</head>
2911<body>
2912
2913<button>Start</button>
2914<div></div>
2915
2916<script>
2917$( "button" ).click(function() {
2918 $( "div" )
2919 .animate({ left:"+=200px" }, 2000 )
2920 .animate({ top:"0px" }, 600 )
2921 .queue(function() {
2922 $( this ).toggleClass( "red" ).dequeue();
2923 })
2924 .animate({ left:"10px", top:"30px" }, 700 );
2925});
2926</script>
2927
2928</body>
2929</html>
2930```
2931 */
2932 dequeue(queueName?: string): this;
2933 /**
2934 * Remove the set of matched elements from the DOM.
2935 * @param selector A selector expression that filters the set of matched elements to be removed.
2936 * @see \`{@link https://api.jquery.com/detach/ }\`
2937 * @since 1.4
2938 * @example ​ ````Detach all paragraphs from the DOM
2939```html
2940<!doctype html>
2941<html lang="en">
2942<head>
2943 <meta charset="utf-8">
2944 <title>detach demo</title>
2945 <style>
2946 p {
2947 background: yellow;
2948 margin: 6px 0;
2949 }
2950 p.off {
2951 background: black;
2952 }
2953 </style>
2954 <script src="https://code.jquery.com/jquery-3.3.1.js"></script>
2955</head>
2956<body>
2957
2958<p>Hello</p>
2959how are
2960<p>you?</p>
2961<button>Attach/detach paragraphs</button>
2962
2963<script>
2964$( "p" ).click(function() {
2965 $( this ).toggleClass( "off" );
2966});
2967var p;
2968$( "button" ).click(function() {
2969 if ( p ) {
2970 p.appendTo( "body" );
2971 p = null;
2972 } else {
2973 p = $( "p" ).detach();
2974 }
2975});
2976</script>
2977
2978</body>
2979</html>
2980```
2981 */
2982 detach(selector?: JQuery.Selector): this;
2983 /**
2984 * Iterate over a jQuery object, executing a function for each matched element.
2985 * @param funсtion A function to execute for each matched element.
2986 * @see \`{@link https://api.jquery.com/each/ }\`
2987 * @since 1.0
2988 * @example ​ ````Iterate over three divs and sets their color property.
2989```html
2990<!doctype html>
2991<html lang="en">
2992<head>
2993 <meta charset="utf-8">
2994 <title>each demo</title>
2995 <style>
2996 div {
2997 color: red;
2998 text-align: center;
2999 cursor: pointer;
3000 font-weight: bolder;
3001 width: 300px;
3002 }
3003 </style>
3004 <script src="https://code.jquery.com/jquery-3.3.1.js"></script>
3005</head>
3006<body>
3007
3008<div>Click here</div>
3009<div>to iterate through</div>
3010<div>these divs.</div>
3011
3012<script>
3013$( document.body ).click(function() {
3014 $( "div" ).each(function( i ) {
3015 if ( this.style.color !== "blue" ) {
3016 this.style.color = "blue";
3017 } else {
3018 this.style.color = "";
3019 }
3020 });
3021});
3022</script>
3023
3024</body>
3025</html>
3026```
3027 * @example ​ ````To access a jQuery object instead of the regular DOM element, use $( this ). For example:
3028```html
3029<!doctype html>
3030<html lang="en">
3031<head>
3032 <meta charset="utf-8">
3033 <title>each demo</title>
3034 <style>
3035 ul {
3036 font-size: 18px;
3037 margin: 0;
3038 }
3039 span {
3040 color: blue;
3041 text-decoration: underline;
3042 cursor: pointer;
3043 }
3044 .example {
3045 font-style: italic;
3046 }
3047 </style>
3048 <script src="https://code.jquery.com/jquery-3.3.1.js"></script>
3049</head>
3050<body>
3051
3052To do list: <span>(click here to change)</span>
3053<ul>
3054 <li>Eat</li>
3055 <li>Sleep</li>
3056 <li>Be merry</li>
3057</ul>
3058
3059<script>
3060$( "span" ).click(function() {
3061 $( "li" ).each(function() {
3062 $( this ).toggleClass( "example" );
3063 });
3064});
3065</script>
3066
3067</body>
3068</html>
3069```
3070 * @example ​ ````Use return false to break out of each() loops early.
3071```html
3072<!doctype html>
3073<html lang="en">
3074<head>
3075 <meta charset="utf-8">
3076 <title>each demo</title>
3077 <style>
3078 div {
3079 width: 40px;
3080 height: 40px;
3081 margin: 5px;
3082 float: left;
3083 border: 2px blue solid;
3084 text-align: center;
3085 }
3086 span {
3087 color: red;
3088 }
3089 </style>
3090 <script src="https://code.jquery.com/jquery-3.3.1.js"></script>
3091</head>
3092<body>
3093
3094<button>Change colors</button>
3095<span></span>
3096<div></div>
3097<div></div>
3098<div></div>
3099<div></div>
3100<div id="stop">Stop here</div>
3101<div></div>
3102<div></div>
3103<div></div>
3104
3105<script>
3106$( "button" ).click(function() {
3107 $( "div" ).each(function( index, element ) {
3108 // element == this
3109 $( element ).css( "backgroundColor", "yellow" );
3110 if ( $( this ).is( "#stop" ) ) {
3111 $( "span" ).text( "Stopped at div index #" + index );
3112 return false;
3113 }
3114 });
3115});
3116</script>
3117
3118</body>
3119</html>
3120```
3121 */
3122 each(funсtion: (this: TElement, index: number, element: TElement) => void | false): this;
3123 /**
3124 * Remove all child nodes of the set of matched elements from the DOM.
3125 * @see \`{@link https://api.jquery.com/empty/ }\`
3126 * @since 1.0
3127 * @example ​ ````Removes all child nodes (including text nodes) from all paragraphs
3128```html
3129<!doctype html>
3130<html lang="en">
3131<head>
3132 <meta charset="utf-8">
3133 <title>empty demo</title>
3134 <style>
3135 p {
3136 background: yellow;
3137 }
3138 </style>
3139 <script src="https://code.jquery.com/jquery-3.3.1.js"></script>
3140</head>
3141<body>
3142
3143<p>
3144 Hello, <span>Person</span> <em>and person</em>.
3145</p>
3146
3147<button>Call empty() on above paragraph</button>
3148
3149<script>
3150$( "button" ).click(function() {
3151 $( "p" ).empty();
3152});
3153</script>
3154
3155</body>
3156</html>
3157```
3158 */
3159 empty(): this;
3160 /**
3161 * End the most recent filtering operation in the current chain and return the set of matched elements to its previous state.
3162 * @see \`{@link https://api.jquery.com/end/ }\`
3163 * @since 1.0
3164 * @example ​ ````Selects all paragraphs, finds span elements inside these, and reverts the selection back to the paragraphs.
3165```html
3166<!doctype html>
3167<html lang="en">
3168<head>
3169 <meta charset="utf-8">
3170 <title>end demo</title>
3171 <style>
3172 p, div {
3173 margin: 1px;
3174 padding: 1px;
3175 font-weight: bold;
3176 font-size: 16px;
3177 }
3178 div {
3179 color: blue;
3180 }
3181 b {
3182 color: red;
3183 }
3184 </style>
3185 <script src="https://code.jquery.com/jquery-3.3.1.js"></script>
3186</head>
3187<body>
3188
3189<p>
3190 Hi there <span>how</span> are you <span>doing</span>?
3191</p>
3192
3193<p>
3194 This <span>span</span> is one of
3195 several <span>spans</span> in this
3196 <span>sentence</span>.
3197</p>
3198
3199<div>
3200 Tags in jQuery object initially: <b></b>
3201</div>
3202
3203<div>
3204 Tags in jQuery object after find: <b></b>
3205</div>
3206
3207<div>
3208 Tags in jQuery object after end: <b></b>
3209</div>
3210
3211<script>
3212jQuery.fn.showTags = function( n ) {
3213 var tags = this.map(function() {
3214 return this.tagName;
3215 })
3216 .get()
3217 .join( ", " );
3218 $( "b:eq( " + n + " )" ).text( tags );
3219 return this;
3220};
3221
3222$( "p" )
3223 .showTags( 0 )
3224 .find( "span" )
3225 .showTags( 1 )
3226 .css( "background", "yellow" )
3227 .end()
3228 .showTags( 2 )
3229 .css( "font-style", "italic" );
3230</script>
3231
3232</body>
3233</html>
3234```
3235 * @example ​ ````Selects all paragraphs, finds span elements inside these, and reverts the selection back to the paragraphs.
3236```html
3237<!doctype html>
3238<html lang="en">
3239<head>
3240 <meta charset="utf-8">
3241 <title>end demo</title>
3242 <style>
3243 p {
3244 margin: 10px;
3245 padding: 10px;
3246 }
3247 </style>
3248 <script src="https://code.jquery.com/jquery-3.3.1.js"></script>
3249</head>
3250<body>
3251
3252<p><span>Hello</span>, how are you?</p>
3253
3254<script>
3255$( "p" )
3256 .find( "span" )
3257 .end()
3258 .css( "border", "2px red solid" );
3259</script>
3260
3261</body>
3262</html>
3263```
3264 */
3265 end(): this;
3266 /**
3267 * Reduce the set of matched elements to the one at the specified index.
3268 * @param index An integer indicating the 0-based position of the element.
3269 * An integer indicating the position of the element, counting backwards from the last element in the set.
3270 * @see \`{@link https://api.jquery.com/eq/ }\`
3271 * @since 1.1.2
3272 * @since 1.4
3273 * @example ​ ````Turn the div with index 2 blue by adding an appropriate class.
3274```html
3275<!doctype html>
3276<html lang="en">
3277<head>
3278 <meta charset="utf-8">
3279 <title>eq demo</title>
3280 <style>
3281 div {
3282 width: 60px;
3283 height: 60px;
3284 margin: 10px;
3285 float: left;
3286 border: 2px solid blue;
3287 }
3288 .blue {
3289 background: blue;
3290 }
3291 </style>
3292 <script src="https://code.jquery.com/jquery-3.3.1.js"></script>
3293</head>
3294<body>
3295
3296<div></div>
3297<div></div>
3298<div></div>
3299<div></div>
3300<div></div>
3301<div></div>
3302
3303<script>
3304$( "body" ).find( "div" ).eq( 2 ).addClass( "blue" );
3305</script>
3306
3307</body>
3308</html>
3309```
3310 */
3311 eq(index: number): this;
3312 /**
3313 * Merge the contents of an object onto the jQuery prototype to provide new jQuery instance methods.
3314 * @param obj An object to merge onto the jQuery prototype.
3315 * @see \`{@link https://api.jquery.com/jQuery.fn.extend/ }\`
3316 * @since 1.0
3317 * @example ​ ````Add two methods to the jQuery prototype ($.fn) object and then use one of them.
3318```html
3319<!doctype html>
3320<html lang="en">
3321<head>
3322 <meta charset="utf-8">
3323 <title>jQuery.fn.extend demo</title>
3324 <style>
3325 label {
3326 display: block;
3327 margin: .5em;
3328 }
3329 </style>
3330 <script src="https://code.jquery.com/jquery-3.3.1.js"></script>
3331</head>
3332<body>
3333
3334<label><input type="checkbox" name="foo"> Foo</label>
3335<label><input type="checkbox" name="bar"> Bar</label>
3336
3337<script>
3338jQuery.fn.extend({
3339 check: function() {
3340 return this.each(function() {
3341 this.checked = true;
3342 });
3343 },
3344 uncheck: function() {
3345 return this.each(function() {
3346 this.checked = false;
3347 });
3348 }
3349});
3350
3351// Use the newly created .check() method
3352$( "input[type='checkbox']" ).check();
3353</script>
3354
3355</body>
3356</html>
3357```
3358 */
3359 extend(obj: object): this;
3360 /**
3361 * Display the matched elements by fading them to opaque.
3362 * @param duration A string or number determining how long the animation will run.
3363 * @param easing A string indicating which easing function to use for the transition.
3364 * @param complete A function to call once the animation is complete, called once per matched element.
3365 * @see \`{@link https://api.jquery.com/fadeIn/ }\`
3366 * @since 1.4.3
3367 */
3368 fadeIn(duration: JQuery.Duration, easing: string, complete?: (this: TElement) => void): this;
3369 /**
3370 * Display the matched elements by fading them to opaque.
3371 * @param duration_easing _&#x40;param_ `duration_easing`
3372 * <br>
3373 * * `duration` — A string or number determining how long the animation will run. <br>
3374 * * `easing` — A string indicating which easing function to use for the transition.
3375 * @param complete A function to call once the animation is complete, called once per matched element.
3376 * @see \`{@link https://api.jquery.com/fadeIn/ }\`
3377 * @since 1.0
3378 * @since 1.4.3
3379 * @example ​ ````Fades a red block in over the text. Once the animation is done, it quickly fades in more text on top.
3380```html
3381<!doctype html>
3382<html lang="en">
3383<head>
3384 <meta charset="utf-8">
3385 <title>fadeIn demo</title>
3386 <style>
3387 p {
3388 position: relative;
3389 width: 400px;
3390 height: 90px;
3391 }
3392 div {
3393 position: absolute;
3394 width: 400px;
3395 height: 65px;
3396 font-size: 36px;
3397 text-align: center;
3398 color: yellow;
3399 background: red;
3400 padding-top: 25px;
3401 top: 0;
3402 left: 0;
3403 display: none;
3404 }
3405 span {
3406 display: none;
3407 }
3408 </style>
3409 <script src="https://code.jquery.com/jquery-3.3.1.js"></script>
3410</head>
3411<body>
3412
3413<p>
3414 Let it be known that the party of the first part
3415 and the party of the second part are henceforth
3416 and hereto directed to assess the allegations
3417 for factual correctness... (<a href="#">click!</a>)
3418 <div><span>CENSORED!</span></div>
3419</p>
3420
3421<script>
3422$( "a" ).click(function() {
3423 $( "div" ).fadeIn( 3000, function() {
3424 $( "span" ).fadeIn( 100 );
3425 });
3426 return false;
3427});
3428</script>
3429
3430</body>
3431</html>
3432```
3433 */
3434 fadeIn(duration_easing: JQuery.Duration | string, complete: (this: TElement) => void): this;
3435 /**
3436 * Display the matched elements by fading them to opaque.
3437 * @param duration_easing_complete_options _&#x40;param_ `duration_easing_complete_options`
3438 * <br>
3439 * * `duration` — A string or number determining how long the animation will run. <br>
3440 * * `easing` — A string indicating which easing function to use for the transition. <br>
3441 * * `complete` — A function to call once the animation is complete, called once per matched element. <br>
3442 * * `options` — A map of additional options to pass to the method.
3443 * @see \`{@link https://api.jquery.com/fadeIn/ }\`
3444 * @since 1.0
3445 * @since 1.4.3
3446 * @example ​ ````Animates hidden divs to fade in one by one, completing each animation within 600 milliseconds.
3447```html
3448<!doctype html>
3449<html lang="en">
3450<head>
3451 <meta charset="utf-8">
3452 <title>fadeIn demo</title>
3453 <style>
3454 span {
3455 color: red;
3456 cursor: pointer;
3457 }
3458 div {
3459 margin: 3px;
3460 width: 80px;
3461 display: none;
3462 height: 80px;
3463 float: left;
3464 }
3465 #one {
3466 background: #f00;
3467 }
3468 #two {
3469 background: #0f0;
3470 }
3471 #three {
3472 background: #00f;
3473 }
3474 </style>
3475 <script src="https://code.jquery.com/jquery-3.3.1.js"></script>
3476</head>
3477<body>
3478
3479<span>Click here...</span>
3480<div id="one"></div>
3481<div id="two"></div>
3482<div id="three"></div>
3483
3484<script>
3485$( document.body ).click(function() {
3486 $( "div:hidden:first" ).fadeIn( "slow" );
3487});
3488</script>
3489
3490</body>
3491</html>
3492```
3493 */
3494 fadeIn(duration_easing_complete_options?: JQuery.Duration | string | ((this: TElement) => void) | JQuery.EffectsOptions<TElement>): this;
3495 /**
3496 * Hide the matched elements by fading them to transparent.
3497 * @param duration A string or number determining how long the animation will run.
3498 * @param easing A string indicating which easing function to use for the transition.
3499 * @param complete A function to call once the animation is complete, called once per matched element.
3500 * @see \`{@link https://api.jquery.com/fadeOut/ }\`
3501 * @since 1.4.3
3502 * @example ​ ````Fades out two divs, one with a &quot;linear&quot; easing and one with the default, &quot;swing,&quot; easing.
3503```html
3504<!doctype html>
3505<html lang="en">
3506<head>
3507 <meta charset="utf-8">
3508 <title>fadeOut demo</title>
3509 <style>
3510 .box,
3511 button {
3512 float: left;
3513 margin: 5px 10px 5px 0;
3514 }
3515 .box {
3516 height: 80px;
3517 width: 80px;
3518 background: #090;
3519 }
3520 #log {
3521 clear: left;
3522 }
3523 </style>
3524 <script src="https://code.jquery.com/jquery-3.3.1.js"></script>
3525</head>
3526<body>
3527
3528<button id="btn1">fade out</button>
3529<button id="btn2">show</button>
3530
3531<div id="log"></div>
3532
3533<div id="box1" class="box">linear</div>
3534<div id="box2" class="box">swing</div>
3535
3536<script>
3537$( "#btn1" ).click(function() {
3538 function complete() {
3539 $( "<div>" ).text( this.id ).appendTo( "#log" );
3540 }
3541 $( "#box1" ).fadeOut( 1600, "linear", complete );
3542 $( "#box2" ).fadeOut( 1600, complete );
3543});
3544
3545$( "#btn2" ).click(function() {
3546 $( "div" ).show();
3547 $( "#log" ).empty();
3548});
3549</script>
3550
3551</body>
3552</html>
3553```
3554 */
3555 fadeOut(duration: JQuery.Duration, easing: string, complete?: (this: TElement) => void): this;
3556 /**
3557 * Hide the matched elements by fading them to transparent.
3558 * @param duration_easing _&#x40;param_ `duration_easing`
3559 * <br>
3560 * * `duration` — A string or number determining how long the animation will run. <br>
3561 * * `easing` — A string indicating which easing function to use for the transition.
3562 * @param complete A function to call once the animation is complete, called once per matched element.
3563 * @see \`{@link https://api.jquery.com/fadeOut/ }\`
3564 * @since 1.0
3565 * @since 1.4.3
3566 * @example ​ ````Fades out spans in one section that you click on.
3567```html
3568<!doctype html>
3569<html lang="en">
3570<head>
3571 <meta charset="utf-8">
3572 <title>fadeOut demo</title>
3573 <style>
3574 span {
3575 cursor: pointer;
3576 }
3577 span.hilite {
3578 background: yellow;
3579 }
3580 div {
3581 display: inline;
3582 color: red;
3583 }
3584 </style>
3585 <script src="https://code.jquery.com/jquery-3.3.1.js"></script>
3586</head>
3587<body>
3588
3589<h3>Find the modifiers - <div></div></h3>
3590<p>
3591 If you <span>really</span> want to go outside
3592 <span>in the cold</span> then make sure to wear
3593 your <span>warm</span> jacket given to you by
3594 your <span>favorite</span> teacher.
3595</p>
3596
3597<script>
3598$( "span" ).click(function() {
3599 $( this ).fadeOut( 1000, function() {
3600 $( "div" ).text( "'" + $( this ).text() + "' has faded!" );
3601 $( this ).remove();
3602 });
3603});
3604$( "span" ).hover(function() {
3605 $( this ).addClass( "hilite" );
3606}, function() {
3607 $( this ).removeClass( "hilite" );
3608});
3609</script>
3610
3611</body>
3612</html>
3613```
3614 */
3615 fadeOut(duration_easing: JQuery.Duration | string, complete: (this: TElement) => void): this;
3616 /**
3617 * Hide the matched elements by fading them to transparent.
3618 * @param duration_easing_complete_options _&#x40;param_ `duration_easing_complete_options`
3619 * <br>
3620 * * `duration` — A string or number determining how long the animation will run. <br>
3621 * * `easing` — A string indicating which easing function to use for the transition. <br>
3622 * * `complete` — A function to call once the animation is complete, called once per matched element. <br>
3623 * * `options` — A map of additional options to pass to the method.
3624 * @see \`{@link https://api.jquery.com/fadeOut/ }\`
3625 * @since 1.0
3626 * @since 1.4.3
3627 * @example ​ ````Animates all paragraphs to fade out, completing the animation within 600 milliseconds.
3628```html
3629<!doctype html>
3630<html lang="en">
3631<head>
3632 <meta charset="utf-8">
3633 <title>fadeOut demo</title>
3634 <style>
3635 p {
3636 font-size: 150%;
3637 cursor: pointer;
3638 }
3639 </style>
3640 <script src="https://code.jquery.com/jquery-3.3.1.js"></script>
3641</head>
3642<body>
3643
3644<p>
3645 If you click on this paragraph
3646 you'll see it just fade away.
3647</p>
3648
3649<script>
3650$( "p" ).click(function() {
3651 $( "p" ).fadeOut( "slow" );
3652});
3653</script>
3654
3655</body>
3656</html>
3657```
3658 */
3659 fadeOut(duration_easing_complete_options?: JQuery.Duration | string | ((this: TElement) => void) | JQuery.EffectsOptions<TElement>): this;
3660 /**
3661 * Adjust the opacity of the matched elements.
3662 * @param duration A string or number determining how long the animation will run.
3663 * @param opacity A number between 0 and 1 denoting the target opacity.
3664 * @param easing A string indicating which easing function to use for the transition.
3665 * @param complete A function to call once the animation is complete, called once per matched element.
3666 * @see \`{@link https://api.jquery.com/fadeTo/ }\`
3667 * @since 1.4.3
3668 */
3669 fadeTo(duration: JQuery.Duration, opacity: number, easing: string, complete?: (this: TElement) => void): this;
3670 /**
3671 * Adjust the opacity of the matched elements.
3672 * @param duration A string or number determining how long the animation will run.
3673 * @param opacity A number between 0 and 1 denoting the target opacity.
3674 * @param complete A function to call once the animation is complete, called once per matched element.
3675 * @see \`{@link https://api.jquery.com/fadeTo/ }\`
3676 * @since 1.0
3677 * @example ​ ````Animates first paragraph to fade to an opacity of 0.33 (33%, about one third visible), completing the animation within 600 milliseconds.
3678```html
3679<!doctype html>
3680<html lang="en">
3681<head>
3682 <meta charset="utf-8">
3683 <title>fadeTo demo</title>
3684 <script src="https://code.jquery.com/jquery-3.3.1.js"></script>
3685</head>
3686<body>
3687
3688<p>
3689Click this paragraph to see it fade.
3690</p>
3691
3692<p>
3693Compare to this one that won't fade.
3694</p>
3695
3696<script>
3697$( "p:first" ).click(function() {
3698 $( this ).fadeTo( "slow", 0.33 );
3699});
3700</script>
3701
3702</body>
3703</html>
3704```
3705 * @example ​ ````Fade div to a random opacity on each click, completing the animation within 200 milliseconds.
3706```html
3707<!doctype html>
3708<html lang="en">
3709<head>
3710 <meta charset="utf-8">
3711 <title>fadeTo demo</title>
3712 <style>
3713 p {
3714 width: 80px;
3715 margin: 0;
3716 padding: 5px;
3717 }
3718 div {
3719 width: 40px;
3720 height: 40px;
3721 position: absolute;
3722 }
3723 #one {
3724 top: 0;
3725 left: 0;
3726 background: #f00;
3727 }
3728 #two {
3729 top: 20px;
3730 left: 20px;
3731 background: #0f0;
3732 }
3733 #three {
3734 top: 40px;
3735 left:40px;
3736 background:#00f;
3737 }
3738 </style>
3739 <script src="https://code.jquery.com/jquery-3.3.1.js"></script>
3740</head>
3741<body>
3742
3743<p>And this is the library that John built...</p>
3744
3745<div id="one"></div>
3746<div id="two"></div>
3747<div id="three"></div>
3748
3749<script>
3750$( "div" ).click(function() {
3751 $( this ).fadeTo( "fast", Math.random() );
3752});
3753</script>
3754
3755</body>
3756</html>
3757```
3758 * @example ​ ````Find the right answer! The fade will take 250 milliseconds and change various styles when it completes.
3759```html
3760<!doctype html>
3761<html lang="en">
3762<head>
3763 <meta charset="utf-8">
3764 <title>fadeTo demo</title>
3765 <style>
3766 div, p {
3767 width: 80px;
3768 height: 40px;
3769 top: 0;
3770 margin: 0;
3771 position: absolute;
3772 padding-top: 8px;
3773 }
3774 p {
3775 background: #fcc;
3776 text-align: center;
3777 }
3778 div {
3779 background: blue;
3780 }
3781 </style>
3782 <script src="https://code.jquery.com/jquery-3.3.1.js"></script>
3783</head>
3784<body>
3785
3786<p>Wrong</p>
3787<div></div>
3788<p>Wrong</p>
3789<div></div>
3790<p>Right!</p>
3791<div></div>
3792
3793<script>
3794var getPos = function( n ) {
3795 return (Math.floor( n ) * 90) + "px";
3796};
3797$( "p" ).each(function( n ) {
3798 var r = Math.floor( Math.random() * 3 );
3799 var tmp = $( this ).text();
3800 $( this ).text( $( "p:eq(" + r + ")" ).text() );
3801 $( "p:eq(" + r + ")" ).text( tmp );
3802 $( this ).css( "left", getPos( n ) );
3803});
3804$( "div" )
3805 .each(function( n ) {
3806 $( this ).css( "left", getPos( n ) );
3807 })
3808 .css( "cursor", "pointer" )
3809 .click( function() {
3810 $( this ).fadeTo( 250, 0.25, function() {
3811 $( this )
3812 .css( "cursor", "" )
3813 .prev()
3814 .css({
3815 "font-weight": "bolder",
3816 "font-style": "italic"
3817 });
3818 });
3819 });
3820</script>
3821
3822</body>
3823</html>
3824```
3825 */
3826 fadeTo(duration: JQuery.Duration, opacity: number, complete?: (this: TElement) => void): this;
3827 /**
3828 * Display or hide the matched elements by animating their opacity.
3829 * @param duration A string or number determining how long the animation will run.
3830 * @param easing A string indicating which easing function to use for the transition.
3831 * @param complete A function to call once the animation is complete, called once per matched element.
3832 * @see \`{@link https://api.jquery.com/fadeToggle/ }\`
3833 * @since 1.4.4
3834 * @example ​ ````Fades first paragraph in or out, completing the animation within 600 milliseconds and using a linear easing. Fades last paragraph in or out for 200 milliseconds, inserting a &quot;finished&quot; message upon completion.
3835```html
3836<!doctype html>
3837<html lang="en">
3838<head>
3839 <meta charset="utf-8">
3840 <title>fadeToggle demo</title>
3841 <script src="https://code.jquery.com/jquery-3.3.1.js"></script>
3842</head>
3843<body>
3844
3845<button>fadeToggle p1</button>
3846<button>fadeToggle p2</button>
3847<p>This paragraph has a slow, linear fade.</p>
3848<p>This paragraph has a fast animation.</p>
3849<div id="log"></div>
3850
3851<script>
3852$( "button:first" ).click(function() {
3853 $( "p:first" ).fadeToggle( "slow", "linear" );
3854});
3855$( "button:last" ).click(function() {
3856 $( "p:last" ).fadeToggle( "fast", function() {
3857 $( "#log" ).append( "<div>finished</div>" );
3858 });
3859});
3860</script>
3861
3862</body>
3863</html>
3864```
3865 */
3866 fadeToggle(duration: JQuery.Duration, easing: string, complete?: (this: TElement) => void): this;
3867 /**
3868 * Display or hide the matched elements by animating their opacity.
3869 * @param duration_easing _&#x40;param_ `duration_easing`
3870 * <br>
3871 * * `duration` — A string or number determining how long the animation will run. <br>
3872 * * `easing` — A string indicating which easing function to use for the transition.
3873 * @param complete A function to call once the animation is complete, called once per matched element.
3874 * @see \`{@link https://api.jquery.com/fadeToggle/ }\`
3875 * @since 1.0
3876 * @since 1.4.3
3877 * @example ​ ````Fades first paragraph in or out, completing the animation within 600 milliseconds and using a linear easing. Fades last paragraph in or out for 200 milliseconds, inserting a &quot;finished&quot; message upon completion.
3878```html
3879<!doctype html>
3880<html lang="en">
3881<head>
3882 <meta charset="utf-8">
3883 <title>fadeToggle demo</title>
3884 <script src="https://code.jquery.com/jquery-3.3.1.js"></script>
3885</head>
3886<body>
3887
3888<button>fadeToggle p1</button>
3889<button>fadeToggle p2</button>
3890<p>This paragraph has a slow, linear fade.</p>
3891<p>This paragraph has a fast animation.</p>
3892<div id="log"></div>
3893
3894<script>
3895$( "button:first" ).click(function() {
3896 $( "p:first" ).fadeToggle( "slow", "linear" );
3897});
3898$( "button:last" ).click(function() {
3899 $( "p:last" ).fadeToggle( "fast", function() {
3900 $( "#log" ).append( "<div>finished</div>" );
3901 });
3902});
3903</script>
3904
3905</body>
3906</html>
3907```
3908 */
3909 fadeToggle(duration_easing: JQuery.Duration | string, complete: (this: TElement) => void): this;
3910 /**
3911 * Display or hide the matched elements by animating their opacity.
3912 * @param duration_easing_complete_options _&#x40;param_ `duration_easing_complete_options`
3913 * <br>
3914 * * `duration` — A string or number determining how long the animation will run. <br>
3915 * * `easing` — A string indicating which easing function to use for the transition. <br>
3916 * * `complete` — A function to call once the animation is complete, called once per matched element. <br>
3917 * * `options` — A map of additional options to pass to the method.
3918 * @see \`{@link https://api.jquery.com/fadeToggle/ }\`
3919 * @since 1.0
3920 * @since 1.4.3
3921 */
3922 fadeToggle(duration_easing_complete_options?: JQuery.Duration | string | ((this: TElement) => void) | JQuery.EffectsOptions<TElement>): this;
3923 /**
3924 * Reduce the set of matched elements to those that match the selector or pass the function's test.
3925 * @param selector_elements_selection_function _&#x40;param_ `selector_elements_selection_function`
3926 * <br>
3927 * * `selector` — A string containing a selector expression to match the current set of elements against. <br>
3928 * * `elements` — One or more DOM elements to match the current set of elements against. <br>
3929 * * `selection` — An existing jQuery object to match the current set of elements against. <br>
3930 * * `function` — A function used as a test for each element in the set. this is the current DOM element.
3931 * @see \`{@link https://api.jquery.com/filter/ }\`
3932 * @since 1.0
3933 * @since 1.4
3934 * @example ​ ````Change the color of all divs; then add a border to those with a &quot;middle&quot; class.
3935```html
3936<!doctype html>
3937<html lang="en">
3938<head>
3939 <meta charset="utf-8">
3940 <title>filter demo</title>
3941 <style>
3942 div {
3943 width: 60px;
3944 height: 60px;
3945 margin: 5px;
3946 float: left;
3947 border: 2px white solid;
3948 }
3949 </style>
3950 <script src="https://code.jquery.com/jquery-3.3.1.js"></script>
3951</head>
3952<body>
3953
3954<div></div>
3955<div class="middle"></div>
3956<div class="middle"></div>
3957<div class="middle"></div>
3958<div class="middle"></div>
3959<div></div>
3960
3961<script>
3962$( "div" )
3963 .css( "background", "#c8ebcc" )
3964 .filter( ".middle" )
3965 .css( "border-color", "red" );
3966</script>
3967
3968</body>
3969</html>
3970```
3971 * @example ​ ````Change the color of all divs; then add a border to the second one (index == 1) and the div with an id of &quot;fourth.&quot;
3972```html
3973<!doctype html>
3974<html lang="en">
3975<head>
3976 <meta charset="utf-8">
3977 <title>filter demo</title>
3978 <style>
3979 div {
3980 width: 60px;
3981 height: 60px;
3982 margin: 5px;
3983 float: left;
3984 border: 3px white solid;
3985 }
3986 </style>
3987 <script src="https://code.jquery.com/jquery-3.3.1.js"></script>
3988</head>
3989<body>
3990
3991<div id="first"></div>
3992<div id="second"></div>
3993<div id="third"></div>
3994<div id="fourth"></div>
3995<div id="fifth"></div>
3996<div id="sixth"></div>
3997
3998<script>
3999$( "div" )
4000 .css( "background", "#b4b0da" )
4001 .filter(function( index ) {
4002 return index === 1 || $( this ).attr( "id" ) === "fourth";
4003 })
4004 .css( "border", "3px double red" );
4005</script>
4006
4007</body>
4008</html>
4009```
4010 * @example ​ ````Select all divs and filter the selection with a DOM element, keeping only the one with an id of &quot;unique&quot;.
4011```javascript
4012$( "div" ).filter( document.getElementById( "unique" ) );
4013```
4014 * @example ​ ````Select all divs and filter the selection with a jQuery object, keeping only the one with an id of &quot;unique&quot;.
4015```javascript
4016$( "div" ).filter( $( "#unique" ) );
4017```
4018 */
4019 filter(selector_elements_selection_function:
4020 JQuery.Selector |
4021 JQuery.TypeOrArray<Element> |
4022 JQuery |
4023 ((this: TElement, index: number, element: TElement) => boolean)
4024 ): this;
4025 /**
4026 * Get the descendants of each element in the current set of matched elements, filtered by a selector, jQuery object, or element.
4027 * @param selector_element _&#x40;param_ `selector_element`
4028 * <br>
4029 * * `selector` — A string containing a selector expression to match elements against. <br>
4030 * * `element` — An element or a jQuery object to match elements against.
4031 * @see \`{@link https://api.jquery.com/find/ }\`
4032 * @since 1.0
4033 * @since 1.6
4034 * @example ​ ````Starts with all paragraphs and searches for descendant span elements, same as $( &quot;p span&quot; )
4035```html
4036<!doctype html>
4037<html lang="en">
4038<head>
4039 <meta charset="utf-8">
4040 <title>find demo</title>
4041 <script src="https://code.jquery.com/jquery-3.3.1.js"></script>
4042</head>
4043<body>
4044
4045<p><span>Hello</span>, how are you?</p>
4046<p>Me? I'm <span>good</span>.</p>
4047
4048<script>
4049$( "p" ).find( "span" ).css( "color", "red" );
4050</script>
4051
4052</body>
4053</html>
4054```
4055 * @example ​ ````A selection using a jQuery collection of all span tags. Only spans within p tags are changed to red while others are left blue.
4056```html
4057<!doctype html>
4058<html lang="en">
4059<head>
4060 <meta charset="utf-8">
4061 <title>find demo</title>
4062 <style>
4063 span {
4064 color: blue;
4065 }
4066 </style>
4067 <script src="https://code.jquery.com/jquery-3.3.1.js"></script>
4068</head>
4069<body>
4070
4071<p><span>Hello</span>, how are you?</p>
4072<p>Me? I'm <span>good</span>.</p>
4073<div>Did you <span>eat</span> yet?</div>
4074
4075<script>
4076var spans = $( "span" );
4077$( "p" ).find( spans ).css( "color", "red" );
4078</script>
4079
4080</body>
4081</html>
4082```
4083 * @example ​ ````Add spans around each word then add a hover and italicize words with the letter t.
4084```html
4085<!doctype html>
4086<html lang="en">
4087<head>
4088 <meta charset="utf-8">
4089 <title>find demo</title>
4090 <style>
4091 p {
4092 font-size: 20px;
4093 width: 200px;
4094 color: blue;
4095 font-weight: bold;
4096 margin: 0 10px;
4097 }
4098 .hilite {
4099 background: yellow;
4100 }
4101 </style>
4102 <script src="https://code.jquery.com/jquery-3.3.1.js"></script>
4103</head>
4104<body>
4105
4106<p>
4107 When the day is short
4108 find that which matters to you
4109 or stop believing
4110</p>
4111
4112<script>
4113var newText = $( "p" ).text().split( " " ).join( "</span> <span>" );
4114newText = "<span>" + newText + "</span>";
4115
4116$( "p" )
4117 .html( newText )
4118 .find( "span" )
4119 .hover(function() {
4120 $( this ).addClass( "hilite" );
4121 }, function() {
4122 $( this ).removeClass( "hilite" );
4123 })
4124 .end()
4125 .find( ":contains('t')" )
4126 .css({
4127 "font-style": "italic",
4128 "font-weight": "bolder"
4129 });
4130</script>
4131
4132</body>
4133</html>
4134```
4135 */
4136 find<K extends keyof HTMLElementTagNameMap>(selector_element: K | JQuery<K>): JQuery<HTMLElementTagNameMap[K]>;
4137 find<K extends keyof SVGElementTagNameMap>(selector_element: K | JQuery<K>): JQuery<SVGElementTagNameMap[K]>;
4138 find<E extends HTMLElement>(selector_element: JQuery.Selector | Element | E | JQuery<E>): JQuery<E>;
4139 /**
4140 * Stop the currently-running animation, remove all queued animations, and complete all animations for the matched elements.
4141 * @param queue The name of the queue in which to stop animations.
4142 * @see \`{@link https://api.jquery.com/finish/ }\`
4143 * @since 1.9
4144 * @example ​ ````Click the Go button once to start the animation, and then click the other buttons to see how they affect the current and queued animations.
4145```html
4146<!doctype html>
4147<html lang="en">
4148<head>
4149 <meta charset="utf-8">
4150 <title>finish demo</title>
4151 <style>
4152 .box {
4153 position: absolute;
4154 top: 10px;
4155 left: 10px;
4156 width: 15px;
4157 height: 15px;
4158 background: black;
4159 }
4160 #path {
4161 height: 244px;
4162 font-size: 70%;
4163 border-left: 2px dashed red;
4164 border-bottom: 2px dashed green;
4165 border-right: 2px dashed blue;
4166 }
4167 button {
4168 width: 12em;
4169 display: block;
4170 text-align: left;
4171 margin: 0 auto;
4172 }
4173 </style>
4174 <script src="https://code.jquery.com/jquery-3.3.1.js"></script>
4175</head>
4176<body>
4177
4178<div class="box"></div>
4179<div id="path">
4180 <button id="go">Go</button>
4181 <br>
4182 <button id="bstt" class="b">.stop( true,true )</button>
4183 <button id="bcf" class="b">.clearQueue().finish()</button>
4184 <br>
4185 <button id="bstf" class="b">.stop( true, false )</button>
4186 <button id="bcs" class="b">.clearQueue().stop()</button>
4187 <br>
4188 <button id="bsff" class="b">.stop( false, false )</button>
4189 <button id="bs" class="b">.stop()</button>
4190 <br>
4191 <button id="bsft" class="b">.stop( false, true )</button>
4192 <br>
4193 <button id="bf" class="b">.finish()</button>
4194</div>
4195
4196<script>
4197var horiz = $( "#path" ).width() - 20,
4198 vert = $( "#path" ).height() - 20;
4199
4200var btns = {
4201 bstt: function() {
4202 $( "div.box" ).stop( true, true );
4203 },
4204 bs: function() {
4205 $( "div.box" ).stop();
4206 },
4207 bsft: function() {
4208 $( "div.box" ).stop( false, true );
4209 },
4210 bf: function() {
4211 $( "div.box" ).finish();
4212 },
4213 bcf: function() {
4214 $( "div.box" ).clearQueue().finish();
4215 },
4216 bsff: function() {
4217 $( "div.box" ).stop( false, false );
4218 },
4219 bstf: function() {
4220 $( "div.box" ).stop( true, false );
4221 },
4222 bcs: function() {
4223 $( "div.box" ).clearQueue().stop();
4224 }
4225};
4226
4227$( "button.b" ).on( "click", function() {
4228 btns[ this.id ]();
4229});
4230
4231$( "#go" ).on( "click", function() {
4232 $( ".box" )
4233 .clearQueue()
4234 .stop()
4235 .css({
4236 left: 10,
4237 top: 10
4238 })
4239 .animate({
4240 top: vert
4241 }, 3000 )
4242 .animate({
4243 left: horiz
4244 }, 3000 )
4245 .animate({
4246 top: 10
4247 }, 3000 );
4248});
4249</script>
4250
4251</body>
4252</html>
4253```
4254 */
4255 finish(queue?: string): this;
4256 /**
4257 * Reduce the set of matched elements to the first in the set.
4258 * @see \`{@link https://api.jquery.com/first/ }\`
4259 * @since 1.4
4260 * @example ​ ````Highlight the first span in a paragraph.
4261```html
4262<!doctype html>
4263<html lang="en">
4264<head>
4265 <meta charset="utf-8">
4266 <title>first demo</title>
4267 <style>
4268 .highlight{
4269 background-color: yellow
4270 }
4271 </style>
4272 <script src="https://code.jquery.com/jquery-3.3.1.js"></script>
4273</head>
4274<body>
4275
4276<p>
4277 <span>Look:</span>
4278 <span>This is some text in a paragraph.</span>
4279 <span>This is a note about it.</span>
4280</p>
4281
4282<script>
4283$( "p span" ).first().addClass( "highlight" );
4284</script>
4285
4286</body>
4287</html>
4288```
4289 */
4290 first(): this;
4291 /**
4292 * Bind an event handler to the "focus" JavaScript event, or trigger that event on an element.
4293 * @param eventData An object containing data that will be passed to the event handler.
4294 * @param handler A function to execute each time the event is triggered.
4295 * @see \`{@link https://api.jquery.com/focus/ }\`
4296 * @since 1.4.3
4297 * @deprecatedDeprecated since 3.3. Use \`{@link on }\` or \`{@link trigger }\`.
4298 *
4299 * **Cause**: The `.on()` and `.trigger()` methods can set an event handler or generate an event for any event type, and should be used instead of the shortcut methods. This message also applies to the other event shorthands, including: blur, focus, focusin, focusout, resize, scroll, dblclick, mousedown, mouseup, mousemove, mouseover, mouseout, mouseenter, mouseleave, change, select, submit, keydown, keypress, keyup, and contextmenu.
4300 *
4301 * **Solution**: Instead of `.click(fn)` use `.on("click", fn)`. Instead of `.click()` use `.trigger("click")`.
4302 */
4303 focus<TData>(eventData: TData,
4304 handler: JQuery.TypeEventHandler<TElement, TData, TElement, TElement, 'focus'>): this;
4305 /**
4306 * Bind an event handler to the "focus" JavaScript event, or trigger that event on an element.
4307 * @param handler A function to execute each time the event is triggered.
4308 * @see \`{@link https://api.jquery.com/focus/ }\`
4309 * @since 1.0
4310 * @deprecatedDeprecated since 3.3. Use \`{@link on }\` or \`{@link trigger }\`.
4311 *
4312 * **Cause**: The `.on()` and `.trigger()` methods can set an event handler or generate an event for any event type, and should be used instead of the shortcut methods. This message also applies to the other event shorthands, including: blur, focus, focusin, focusout, resize, scroll, dblclick, mousedown, mouseup, mousemove, mouseover, mouseout, mouseenter, mouseleave, change, select, submit, keydown, keypress, keyup, and contextmenu.
4313 *
4314 * **Solution**: Instead of `.click(fn)` use `.on("click", fn)`. Instead of `.click()` use `.trigger("click")`.
4315 * @example ​ ````Fire focus.
4316```html
4317<!doctype html>
4318<html lang="en">
4319<head>
4320 <meta charset="utf-8">
4321 <title>focus demo</title>
4322 <style>
4323 span {
4324 display: none;
4325 }
4326 </style>
4327 <script src="https://code.jquery.com/jquery-3.3.1.js"></script>
4328</head>
4329<body>
4330
4331<p><input type="text"> <span>focus fire</span></p>
4332<p><input type="password"> <span>focus fire</span></p>
4333
4334<script>
4335$( "input" ).focus(function() {
4336 $( this ).next( "span" ).css( "display", "inline" ).fadeOut( 1000 );
4337});
4338</script>
4339
4340</body>
4341</html>
4342```
4343 * @example ​ ````To stop people from writing in text input boxes, try:
4344```javascript
4345$( "input[type=text]" ).focus(function() {
4346 $( this ).blur();
4347});
4348```
4349 * @example ​ ````To focus on a login input box with id &#39;login&#39; on page startup, try:
4350```javascript
4351$( document ).ready(function() {
4352 $( "#login" ).focus();
4353});
4354```
4355 */
4356 focus(handler?: JQuery.TypeEventHandler<TElement, null, TElement, TElement, 'focus'> |
4357 false): this;
4358 /**
4359 * Bind an event handler to the "focusin" event.
4360 * @param eventData An object containing data that will be passed to the event handler.
4361 * @param handler A function to execute each time the event is triggered.
4362 * @see \`{@link https://api.jquery.com/focusin/ }\`
4363 * @since 1.4.3
4364 * @deprecatedDeprecated since 3.3. Use \`{@link on }\` or \`{@link trigger }\`.
4365 *
4366 * **Cause**: The `.on()` and `.trigger()` methods can set an event handler or generate an event for any event type, and should be used instead of the shortcut methods. This message also applies to the other event shorthands, including: blur, focus, focusin, focusout, resize, scroll, dblclick, mousedown, mouseup, mousemove, mouseover, mouseout, mouseenter, mouseleave, change, select, submit, keydown, keypress, keyup, and contextmenu.
4367 *
4368 * **Solution**: Instead of `.click(fn)` use `.on("click", fn)`. Instead of `.click()` use `.trigger("click")`.
4369 */
4370 focusin<TData>(eventData: TData,
4371 handler: JQuery.TypeEventHandler<TElement, TData, TElement, TElement, 'focusin'>): this;
4372 /**
4373 * Bind an event handler to the "focusin" event.
4374 * @param handler A function to execute each time the event is triggered.
4375 * @see \`{@link https://api.jquery.com/focusin/ }\`
4376 * @since 1.4
4377 * @deprecatedDeprecated since 3.3. Use \`{@link on }\` or \`{@link trigger }\`.
4378 *
4379 * **Cause**: The `.on()` and `.trigger()` methods can set an event handler or generate an event for any event type, and should be used instead of the shortcut methods. This message also applies to the other event shorthands, including: blur, focus, focusin, focusout, resize, scroll, dblclick, mousedown, mouseup, mousemove, mouseover, mouseout, mouseenter, mouseleave, change, select, submit, keydown, keypress, keyup, and contextmenu.
4380 *
4381 * **Solution**: Instead of `.click(fn)` use `.on("click", fn)`. Instead of `.click()` use `.trigger("click")`.
4382 * @example ​ ````Watch for a focus to occur within the paragraphs on the page.
4383```html
4384<!doctype html>
4385<html lang="en">
4386<head>
4387 <meta charset="utf-8">
4388 <title>focusin demo</title>
4389 <style>
4390 span {
4391 display: none;
4392 }
4393 </style>
4394 <script src="https://code.jquery.com/jquery-3.3.1.js"></script>
4395</head>
4396<body>
4397
4398<p><input type="text"> <span>focusin fire</span></p>
4399<p><input type="password"> <span>focusin fire</span></p>
4400
4401<script>
4402$( "p" ).focusin(function() {
4403 $( this ).find( "span" ).css( "display", "inline" ).fadeOut( 1000 );
4404});
4405</script>
4406
4407</body>
4408</html>
4409```
4410 */
4411 focusin(handler?: JQuery.TypeEventHandler<TElement, null, TElement, TElement, 'focusin'> |
4412 false): this;
4413 /**
4414 * Bind an event handler to the "focusout" JavaScript event.
4415 * @param eventData An object containing data that will be passed to the event handler.
4416 * @param handler A function to execute each time the event is triggered.
4417 * @see \`{@link https://api.jquery.com/focusout/ }\`
4418 * @since 1.4.3
4419 * @deprecatedDeprecated since 3.3. Use \`{@link on }\` or \`{@link trigger }\`.
4420 *
4421 * **Cause**: The `.on()` and `.trigger()` methods can set an event handler or generate an event for any event type, and should be used instead of the shortcut methods. This message also applies to the other event shorthands, including: blur, focus, focusin, focusout, resize, scroll, dblclick, mousedown, mouseup, mousemove, mouseover, mouseout, mouseenter, mouseleave, change, select, submit, keydown, keypress, keyup, and contextmenu.
4422 *
4423 * **Solution**: Instead of `.click(fn)` use `.on("click", fn)`. Instead of `.click()` use `.trigger("click")`.
4424 */
4425 focusout<TData>(eventData: TData,
4426 handler: JQuery.TypeEventHandler<TElement, TData, TElement, TElement, 'focusout'>): this;
4427 /**
4428 * Bind an event handler to the "focusout" JavaScript event.
4429 * @param handler A function to execute each time the event is triggered.
4430 * @see \`{@link https://api.jquery.com/focusout/ }\`
4431 * @since 1.4
4432 * @deprecatedDeprecated since 3.3. Use \`{@link on }\` or \`{@link trigger }\`.
4433 *
4434 * **Cause**: The `.on()` and `.trigger()` methods can set an event handler or generate an event for any event type, and should be used instead of the shortcut methods. This message also applies to the other event shorthands, including: blur, focus, focusin, focusout, resize, scroll, dblclick, mousedown, mouseup, mousemove, mouseover, mouseout, mouseenter, mouseleave, change, select, submit, keydown, keypress, keyup, and contextmenu.
4435 *
4436 * **Solution**: Instead of `.click(fn)` use `.on("click", fn)`. Instead of `.click()` use `.trigger("click")`.
4437 * @example ​ ````Watch for a loss of focus to occur inside paragraphs and note the difference between the focusout count and the blur count. (The blur count does not change because those events do not bubble.)
4438```html
4439<!doctype html>
4440<html lang="en">
4441<head>
4442 <meta charset="utf-8">
4443 <title>focusout demo</title>
4444 <style>
4445 .inputs {
4446 float: left;
4447 margin-right: 1em;
4448 }
4449 .inputs p {
4450 margin-top: 0;
4451 }
4452 </style>
4453 <script src="https://code.jquery.com/jquery-3.3.1.js"></script>
4454</head>
4455<body>
4456
4457<div class="inputs">
4458 <p>
4459 <input type="text"><br>
4460 <input type="text">
4461 </p>
4462 <p>
4463 <input type="password">
4464 </p>
4465</div>
4466<div id="focus-count">focusout fire</div>
4467<div id="blur-count">blur fire</div>
4468
4469<script>
4470var focus = 0,
4471 blur = 0;
4472$( "p" )
4473 .focusout(function() {
4474 focus++;
4475 $( "#focus-count" ).text( "focusout fired: " + focus + "x" );
4476 })
4477 .blur(function() {
4478 blur++;
4479 $( "#blur-count" ).text( "blur fired: " + blur + "x" );
4480 });
4481</script>
4482
4483</body>
4484</html>
4485```
4486 */
4487 focusout(handler?: JQuery.TypeEventHandler<TElement, null, TElement, TElement, 'focusout'> |
4488 false): this;
4489 /**
4490 * Retrieve one of the elements matched by the jQuery object.
4491 * @param index A zero-based integer indicating which element to retrieve.
4492 * @see \`{@link https://api.jquery.com/get/ }\`
4493 * @since 1.0
4494 * @example ​ ````Display the tag name of the click element.
4495```html
4496<!doctype html>
4497<html lang="en">
4498<head>
4499 <meta charset="utf-8">
4500 <title>get demo</title>
4501 <style>
4502 span {
4503 color: red;
4504 }
4505 div {
4506 background: yellow;
4507 }
4508 </style>
4509 <script src="https://code.jquery.com/jquery-3.3.1.js"></script>
4510</head>
4511<body>
4512
4513<span>&nbsp;</span>
4514<p>In this paragraph is an <span>important</span> section</p>
4515<div><input type="text"></div>
4516
4517<script>
4518$( "*", document.body ).click(function( event ) {
4519 event.stopPropagation();
4520 var domElement = $( this ).get( 0 );
4521 $( "span:first" ).text( "Clicked on - " + domElement.nodeName );
4522});
4523</script>
4524
4525</body>
4526</html>
4527```
4528 */
4529 get(index: number): TElement;
4530 /**
4531 * Retrieve the elements matched by the jQuery object.
4532 * @see \`{@link https://api.jquery.com/get/ }\`
4533 * @since 1.0
4534 * @example ​ ````Select all divs in the document and return the DOM Elements as an Array; then use the built-in reverse() method to reverse that array.
4535```html
4536<!doctype html>
4537<html lang="en">
4538<head>
4539 <meta charset="utf-8">
4540 <title>get demo</title>
4541 <style>
4542 span {
4543 color: red;
4544 }
4545 </style>
4546 <script src="https://code.jquery.com/jquery-3.3.1.js"></script>
4547</head>
4548<body>
4549
4550Reversed - <span></span>
4551
4552<div>One</div>
4553<div>Two</div>
4554<div>Three</div>
4555
4556<script>
4557function display( divs ) {
4558 var a = [];
4559 for ( var i = 0; i < divs.length; i++ ) {
4560 a.push( divs[ i ].innerHTML );
4561 }
4562 $( "span" ).text( a.join(" ") );
4563}
4564display( $( "div" ).get().reverse() );
4565</script>
4566
4567</body>
4568</html>
4569```
4570 */
4571 get(): TElement[];
4572 /**
4573 * Reduce the set of matched elements to those that have a descendant that matches the selector or DOM element.
4574 * @param selector_contained _&#x40;param_ `selector_contained`
4575 * <br>
4576 * * `selector` — A string containing a selector expression to match elements against. <br>
4577 * * `contained` — A DOM element to match elements against.
4578 * @see \`{@link https://api.jquery.com/has/ }\`
4579 * @since 1.4
4580 * @example ​ ````Check if an element is inside another.
4581```html
4582<!doctype html>
4583<html lang="en">
4584<head>
4585 <meta charset="utf-8">
4586 <title>has demo</title>
4587 <style>
4588 .full {
4589 border: 1px solid red;
4590 }
4591 </style>
4592 <script src="https://code.jquery.com/jquery-3.3.1.js"></script>
4593</head>
4594<body>
4595
4596<ul><li>Does the UL contain an LI?</li></ul>
4597
4598<script>
4599$( "ul" ).append( "<li>" +
4600 ( $( "ul" ).has( "li" ).length ? "Yes" : "No" ) +
4601 "</li>" );
4602$( "ul" ).has( "li" ).addClass( "full" );
4603</script>
4604
4605</body>
4606</html>
4607```
4608 */
4609 has(selector_contained: string | Element): this;
4610 /**
4611 * Determine whether any of the matched elements are assigned the given class.
4612 * @param className The class name to search for.
4613 * @see \`{@link https://api.jquery.com/hasClass/ }\`
4614 * @since 1.2
4615 * @example ​ ````Looks for the paragraph that contains &#39;selected&#39; as a class.
4616```html
4617<!doctype html>
4618<html lang="en">
4619<head>
4620 <meta charset="utf-8">
4621 <title>hasClass demo</title>
4622 <style>
4623 p {
4624 margin: 8px;
4625 font-size: 16px;
4626 }
4627 .selected {
4628 color: red;
4629 }
4630 </style>
4631 <script src="https://code.jquery.com/jquery-3.3.1.js"></script>
4632</head>
4633<body>
4634
4635<p>This paragraph is black and is the first paragraph.</p>
4636<p class="selected">This paragraph is red and is the second paragraph.</p>
4637<div id="result1">First paragraph has selected class: </div>
4638<div id="result2">Second paragraph has selected class: </div>
4639<div id="result3">At least one paragraph has selected class: </div>
4640
4641<script>
4642$( "#result1" ).append( $( "p:first" ).hasClass( "selected" ).toString() );
4643$( "#result2" ).append( $( "p:last" ).hasClass( "selected" ).toString() );
4644$( "#result3" ).append( $( "p" ).hasClass( "selected" ).toString() ) ;
4645</script>
4646
4647</body>
4648</html>
4649```
4650 */
4651 hasClass(className: string): boolean;
4652 /**
4653 * Set the CSS height of every matched element.
4654 * @param value_function _&#x40;param_ `value_function`
4655 * <br>
4656 * * `value` — An integer representing the number of pixels, or an integer with an optional unit of measure
4657 * appended (as a string). <br>
4658 * * `function` — A function returning the height to set. Receives the index position of the element in the set and
4659 * the old height as arguments. Within the function, `this` refers to the current element in the set.
4660 * @see \`{@link https://api.jquery.com/height/ }\`
4661 * @since 1.0
4662 * @since 1.4.1
4663 * @example ​ ````To set the height of each div on click to 30px plus a color change.
4664```html
4665<!doctype html>
4666<html lang="en">
4667<head>
4668 <meta charset="utf-8">
4669 <title>height demo</title>
4670 <style>
4671 div {
4672 width: 50px;
4673 height: 70px;
4674 float: left;
4675 margin: 5px;
4676 background: rgb(255,140,0);
4677 cursor: pointer;
4678 }
4679 </style>
4680 <script src="https://code.jquery.com/jquery-3.3.1.js"></script>
4681</head>
4682<body>
4683
4684<div></div>
4685<div></div>
4686<div></div>
4687<div></div>
4688<div></div>
4689
4690<script>
4691$( "div" ).one( "click", function() {
4692 $( this ).height( 30 ).css({
4693 cursor: "auto",
4694 backgroundColor: "green"
4695 });
4696});
4697</script>
4698
4699</body>
4700</html>
4701```
4702 */
4703 height(value_function: string | number | ((this: TElement, index: number, height: number) => string | number)): this;
4704 /**
4705 * Get the current computed height for the first element in the set of matched elements.
4706 * @see \`{@link https://api.jquery.com/height/ }\`
4707 * @since 1.0
4708 * @example ​ ````Show various heights. Note the values are from the iframe so might be smaller than you expected. The yellow highlight shows the iframe body.
4709```html
4710<!doctype html>
4711<html lang="en">
4712<head>
4713 <meta charset="utf-8">
4714 <title>height demo</title>
4715 <style>
4716 body {
4717 background: yellow;
4718 }
4719 button {
4720 font-size: 12px;
4721 margin: 2px;
4722 }
4723 p {
4724 width: 150px;
4725 border: 1px red solid;
4726 }
4727 div {
4728 color: red;
4729 font-weight: bold;
4730 }
4731 </style>
4732 <script src="https://code.jquery.com/jquery-3.3.1.js"></script>
4733</head>
4734<body>
4735
4736<button id="getp">Get Paragraph Height</button>
4737<button id="getd">Get Document Height</button>
4738<button id="getw">Get Window Height</button>
4739
4740<div>&nbsp;</div>
4741<p>
4742 Sample paragraph to test height
4743</p>
4744
4745<script>
4746function showHeight( element, height ) {
4747 $( "div" ).text( "The height for the " + element + " is " + height + "px." );
4748}
4749$( "#getp" ).click(function() {
4750 showHeight( "paragraph", $( "p" ).height() );
4751});
4752$( "#getd" ).click(function() {
4753 showHeight( "document", $( document ).height() );
4754});
4755$( "#getw" ).click(function() {
4756 showHeight( "window", $( window ).height() );
4757});
4758</script>
4759
4760</body>
4761</html>
4762```
4763 */
4764 height(): number | undefined;
4765 /**
4766 * Hide the matched elements.
4767 * @param duration A string or number determining how long the animation will run.
4768 * @param easing A string indicating which easing function to use for the transition.
4769 * @param complete A function to call once the animation is complete, called once per matched element.
4770 * @see \`{@link https://api.jquery.com/hide/ }\`
4771 * @since 1.4.3
4772 */
4773 hide(duration: JQuery.Duration, easing: string, complete: (this: TElement) => void): this;
4774 /**
4775 * Hide the matched elements.
4776 * @param duration A string or number determining how long the animation will run.
4777 * @param easing_complete _&#x40;param_ `easing_complete`
4778 * <br>
4779 * * `easing` — A string indicating which easing function to use for the transition. <br>
4780 * * `complete` — A function to call once the animation is complete, called once per matched element.
4781 * @see \`{@link https://api.jquery.com/hide/ }\`
4782 * @since 1.0
4783 * @since 1.4.3
4784 * @example ​ ````Animates all spans (words in this case) to hide fastly, completing each animation within 200 milliseconds. Once each animation is done, it starts the next one.
4785```html
4786<!doctype html>
4787<html lang="en">
4788<head>
4789 <meta charset="utf-8">
4790 <title>hide demo</title>
4791 <style>
4792 span {
4793 background: #def3ca;
4794 padding: 3px;
4795 float: left;
4796 }
4797 </style>
4798 <script src="https://code.jquery.com/jquery-3.3.1.js"></script>
4799</head>
4800<body>
4801
4802<button id="hider">Hide</button>
4803<button id="shower">Show</button>
4804<div>
4805 <span>Once</span> <span>upon</span> <span>a</span>
4806 <span>time</span> <span>there</span> <span>were</span>
4807 <span>three</span> <span>programmers...</span>
4808</div>
4809
4810<script>
4811$( "#hider" ).click(function() {
4812 $( "span:last-child" ).hide( "fast", function() {
4813 // Use arguments.callee so we don't need a named function
4814 $( this ).prev().hide( "fast", arguments.callee );
4815 });
4816});
4817$( "#shower" ).click(function() {
4818 $( "span" ).show( 2000 );
4819});
4820</script>
4821
4822</body>
4823</html>
4824```
4825 * @example ​ ````Hides the divs when clicked over 2 seconds, then removes the div element when its hidden. Try clicking on more than one box at a time.
4826```html
4827<!doctype html>
4828<html lang="en">
4829<head>
4830 <meta charset="utf-8">
4831 <title>hide demo</title>
4832 <style>
4833 div {
4834 background: #ece023;
4835 width: 30px;
4836 height: 40px;
4837 margin: 2px;
4838 float: left;
4839 }
4840 </style>
4841 <script src="https://code.jquery.com/jquery-3.3.1.js"></script>
4842</head>
4843<body>
4844
4845<div></div>
4846
4847<script>
4848for ( var i = 0; i < 5; i++ ) {
4849 $( "<div>" ).appendTo( document.body );
4850}
4851$( "div" ).click(function() {
4852 $( this ).hide( 2000, function() {
4853 $( this ).remove();
4854 });
4855});
4856</script>
4857
4858</body>
4859</html>
4860```
4861 */
4862 hide(duration: JQuery.Duration, easing_complete: string | ((this: TElement) => void)): this;
4863 /**
4864 * Hide the matched elements.
4865 * @param duration_complete_options _&#x40;param_ `duration_complete_options`
4866 * <br>
4867 * * `duration` — A string or number determining how long the animation will run. <br>
4868 * * `complete` — A function to call once the animation is complete, called once per matched element. <br>
4869 * * `options` — A map of additional options to pass to the method.
4870 * @see \`{@link https://api.jquery.com/hide/ }\`
4871 * @since 1.0
4872 * @example ​ ````Hides all paragraphs then the link on click.
4873```html
4874<!doctype html>
4875<html lang="en">
4876<head>
4877 <meta charset="utf-8">
4878 <title>hide demo</title>
4879 <script src="https://code.jquery.com/jquery-3.3.1.js"></script>
4880</head>
4881<body>
4882
4883<p>Hello</p>
4884<a href="#">Click to hide me too</a>
4885<p>Here is another paragraph</p>
4886
4887<script>
4888$( "p" ).hide();
4889$( "a" ).click(function( event ) {
4890 event.preventDefault();
4891 $( this ).hide();
4892});
4893</script>
4894
4895</body>
4896</html>
4897```
4898 * @example ​ ````Animates all shown paragraphs to hide slowly, completing the animation within 600 milliseconds.
4899```html
4900<!doctype html>
4901<html lang="en">
4902<head>
4903 <meta charset="utf-8">
4904 <title>hide demo</title>
4905 <style>
4906 p {
4907 background: #dad;
4908 font-weight: bold;
4909 }
4910 </style>
4911 <script src="https://code.jquery.com/jquery-3.3.1.js"></script>
4912</head>
4913<body>
4914
4915<button>Hide 'em</button>
4916<p>Hiya</p>
4917<p>Such interesting text, eh?</p>
4918
4919<script>
4920$( "button" ).click(function() {
4921 $( "p" ).hide( "slow" );
4922});
4923</script>
4924
4925</body>
4926</html>
4927```
4928 */
4929 hide(duration_complete_options?: JQuery.Duration | ((this: TElement) => void) | JQuery.EffectsOptions<TElement>): this;
4930 /**
4931 * Bind two handlers to the matched elements, to be executed when the mouse pointer enters and leaves the elements.
4932 * @param handlerIn A function to execute when the mouse pointer enters the element.
4933 * @param handlerOut A function to execute when the mouse pointer leaves the element.
4934 * @see \`{@link https://api.jquery.com/hover/ }\`
4935 * @since 1.0
4936 * @deprecatedDeprecated.
4937 *
4938 * **Cause**: The `.hover()` method is a shorthand for the use of the `mouseover`/`mouseout` events. It is often a poor user interface choice because it does not allow for any small amounts of delay between when the mouse enters or exits an area and when the event fires. This can make it quite difficult to use with UI widgets such as drop-down menus. For more information on the problems of hovering, see the \`{@link http://cherne.net/brian/resources/jquery.hoverIntent.html hoverIntent plugin}\`.
4939 *
4940 * **Solution**: Review uses of `.hover()` to determine if they are appropriate, and consider use of plugins such as `hoverIntent` as an alternative. The direct replacement for `.hover(fn1, fn2)`, is `.on("mouseenter", fn1).on("mouseleave", fn2)`.
4941 * @example ​ ````To add a special style to list items that are being hovered over, try:
4942```html
4943<!doctype html>
4944<html lang="en">
4945<head>
4946 <meta charset="utf-8">
4947 <title>hover demo</title>
4948 <style>
4949 ul {
4950 margin-left: 20px;
4951 color: blue;
4952 }
4953 li {
4954 cursor: default;
4955 }
4956 span {
4957 color: red;
4958 }
4959 </style>
4960 <script src="https://code.jquery.com/jquery-3.3.1.js"></script>
4961</head>
4962<body>
4963
4964<ul>
4965 <li>Milk</li>
4966 <li>Bread</li>
4967 <li class="fade">Chips</li>
4968 <li class="fade">Socks</li>
4969</ul>
4970
4971<script>
4972$( "li" ).hover(
4973 function() {
4974 $( this ).append( $( "<span> ***</span>" ) );
4975 }, function() {
4976 $( this ).find( "span:last" ).remove();
4977 }
4978);
4979
4980$( "li.fade" ).hover(function() {
4981 $( this ).fadeOut( 100 );
4982 $( this ).fadeIn( 500 );
4983});
4984</script>
4985
4986</body>
4987</html>
4988```
4989 * @example ​ ````To add a special style to table cells that are being hovered over, try:
4990```javascript
4991$( "td" ).hover(
4992 function() {
4993 $( this ).addClass( "hover" );
4994 }, function() {
4995 $( this ).removeClass( "hover" );
4996 }
4997);
4998```
4999 * @example ​ ````To unbind the above example use:
5000```javascript
5001$( "td" ).off( "mouseenter mouseleave" );
5002```
5003 */
5004 hover(handlerIn: JQuery.TypeEventHandler<TElement, null, TElement, TElement, 'mouseenter'> |
5005 false,
5006 handlerOut: JQuery.TypeEventHandler<TElement, null, TElement, TElement, 'mouseleave'> |
5007 false): this;
5008 /**
5009 * Bind a single handler to the matched elements, to be executed when the mouse pointer enters or leaves the elements.
5010 * @param handlerInOut A function to execute when the mouse pointer enters or leaves the element.
5011 * @see \`{@link https://api.jquery.com/hover/ }\`
5012 * @since 1.4
5013 * @deprecatedDeprecated.
5014 *
5015 * **Cause**: The `.hover()` method is a shorthand for the use of the `mouseover`/`mouseout` events. It is often a poor user interface choice because it does not allow for any small amounts of delay between when the mouse enters or exits an area and when the event fires. This can make it quite difficult to use with UI widgets such as drop-down menus. For more information on the problems of hovering, see the \`{@link http://cherne.net/brian/resources/jquery.hoverIntent.html hoverIntent plugin}\`.
5016 *
5017 * **Solution**: Review uses of `.hover()` to determine if they are appropriate, and consider use of plugins such as `hoverIntent` as an alternative. The direct replacement for `.hover(fn1, fn2)`, is `.on("mouseenter", fn1).on("mouseleave", fn2)`.
5018 * @example ​ ````Slide the next sibling LI up or down on hover, and toggle a class.
5019```html
5020<!doctype html>
5021<html lang="en">
5022<head>
5023 <meta charset="utf-8">
5024 <title>hover demo</title>
5025 <style>
5026 ul {
5027 margin-left: 20px;
5028 color: blue;
5029 }
5030 li {
5031 cursor: default;
5032 }
5033 li.active {
5034 background: black;
5035 color: white;
5036 }
5037 span {
5038 color:red;
5039 }
5040 </style>
5041 <script src="https://code.jquery.com/jquery-3.3.1.js"></script>
5042</head>
5043<body>
5044
5045<ul>
5046 <li>Milk</li>
5047 <li>White</li>
5048 <li>Carrots</li>
5049 <li>Orange</li>
5050 <li>Broccoli</li>
5051 <li>Green</li>
5052</ul>
5053
5054<script>
5055$( "li" )
5056 .filter( ":odd" )
5057 .hide()
5058 .end()
5059 .filter( ":even" )
5060 .hover(function() {
5061 $( this )
5062 .toggleClass( "active" )
5063 .next()
5064 .stop( true, true )
5065 .slideToggle();
5066 });
5067</script>
5068
5069</body>
5070</html>
5071```
5072 */
5073 hover(handlerInOut: JQuery.TypeEventHandler<TElement, null, TElement, TElement, 'mouseenter' | 'mouseleave'> |
5074 false): this;
5075 /**
5076 * Set the HTML contents of each element in the set of matched elements.
5077 * @param htmlString_function _&#x40;param_ `htmlString_function`
5078 * <br>
5079 * * `htmlString` — A string of HTML to set as the content of each matched element. <br>
5080 * * `function` — A function returning the HTML content to set. Receives the index position of the element in the set
5081 * and the old HTML value as arguments. jQuery empties the element before calling the function; use the
5082 * oldhtml argument to reference the previous content. Within the function, `this` refers to the current
5083 * element in the set.
5084 * @see \`{@link https://api.jquery.com/html/ }\`
5085 * @since 1.0
5086 * @since 1.4
5087 * @example ​ ````Add some html to each div.
5088```html
5089<!doctype html>
5090<html lang="en">
5091<head>
5092 <meta charset="utf-8">
5093 <title>html demo</title>
5094 <style>
5095 .red {
5096 color: red;
5097 }
5098 </style>
5099 <script src="https://code.jquery.com/jquery-3.3.1.js"></script>
5100</head>
5101<body>
5102
5103<span>Hello</span>
5104<div></div>
5105<div></div>
5106<div></div>
5107
5108<script>
5109$( "div" ).html( "<span class='red'>Hello <b>Again</b></span>" );
5110</script>
5111
5112</body>
5113</html>
5114```
5115 * @example ​ ````Add some html to each div then immediately do further manipulations to the inserted html.
5116```html
5117<!doctype html>
5118<html lang="en">
5119<head>
5120 <meta charset="utf-8">
5121 <title>html demo</title>
5122 <style>
5123 div {
5124 color: blue;
5125 font-size: 18px;
5126 }
5127 </style>
5128 <script src="https://code.jquery.com/jquery-3.3.1.js"></script>
5129</head>
5130<body>
5131
5132<div></div>
5133<div></div>
5134<div></div>
5135
5136<script>
5137$( "div" ).html( "<b>Wow!</b> Such excitement..." );
5138$( "div b" )
5139 .append( document.createTextNode( "!!!" ) )
5140 .css( "color", "red" );
5141</script>
5142
5143</body>
5144</html>
5145```
5146 */
5147 html(htmlString_function: JQuery.htmlString |
5148 JQuery.Node |
5149 ((this: TElement, index: number, oldhtml: JQuery.htmlString) => JQuery.htmlString | JQuery.Node)): this;
5150 /**
5151 * Get the HTML contents of the first element in the set of matched elements.
5152 * @see \`{@link https://api.jquery.com/html/ }\`
5153 * @since 1.0
5154 * @example ​ ````Click a paragraph to convert it from html to text.
5155```html
5156<!doctype html>
5157<html lang="en">
5158<head>
5159 <meta charset="utf-8">
5160 <title>html demo</title>
5161 <style>
5162 p {
5163 margin: 8px;
5164 font-size: 20px;
5165 color: blue;
5166 cursor: pointer;
5167 }
5168 b {
5169 text-decoration: underline;
5170 }
5171 button {
5172 cursor: pointer;
5173 }
5174 </style>
5175 <script src="https://code.jquery.com/jquery-3.3.1.js"></script>
5176</head>
5177<body>
5178
5179<p>
5180 <b>Click</b> to change the <span id="tag">html</span>
5181</p>
5182<p>
5183 to a <span id="text">text</span> node.
5184</p>
5185<p>
5186 This <button name="nada">button</button> does nothing.
5187</p>
5188
5189<script>
5190$( "p" ).click(function() {
5191 var htmlString = $( this ).html();
5192 $( this ).text( htmlString );
5193});
5194</script>
5195
5196</body>
5197</html>
5198```
5199 */
5200 html(): string;
5201 /**
5202 * Search for a given element from among the matched elements.
5203 * @param selector_element _&#x40;param_ `selector_element`
5204 * <br>
5205 * * `selector` — A selector representing a jQuery collection in which to look for an element. <br>
5206 * * `element` — The DOM element or first element within the jQuery object to look for.
5207 * @see \`{@link https://api.jquery.com/index/ }\`
5208 * @since 1.0
5209 * @since 1.4
5210 * @example ​ ````On click, returns the index (zero-based) of that div in the page.
5211```html
5212<!doctype html>
5213<html lang="en">
5214<head>
5215 <meta charset="utf-8">
5216 <title>index demo</title>
5217 <style>
5218 div {
5219 background: yellow;
5220 margin: 5px;
5221 }
5222 span {
5223 color: red;
5224 }
5225 </style>
5226 <script src="https://code.jquery.com/jquery-3.3.1.js"></script>
5227</head>
5228<body>
5229
5230<span>Click a div!</span>
5231<div>First div</div>
5232<div>Second div</div>
5233<div>Third div</div>
5234
5235<script>
5236$( "div" ).click(function() {
5237 // `this` is the DOM element that was clicked
5238 var index = $( "div" ).index( this );
5239 $( "span" ).text( "That was div index #" + index );
5240});
5241</script>
5242
5243</body>
5244</html>
5245```
5246 * @example ​ ````Returns the index for the element with ID bar.
5247```html
5248<!doctype html>
5249<html lang="en">
5250<head>
5251 <meta charset="utf-8">
5252 <title>index demo</title>
5253 <style>
5254 div {
5255 font-weight: bold;
5256 color: #090;
5257 }
5258 </style>
5259 <script src="https://code.jquery.com/jquery-3.3.1.js"></script>
5260</head>
5261<body>
5262
5263<ul>
5264 <li id="foo">foo</li>
5265 <li id="bar">bar</li>
5266 <li id="baz">baz</li>
5267</ul>
5268<div></div>
5269
5270<script>
5271var listItem = $( "#bar" );
5272$( "div" ).html( "Index: " + $( "li" ).index( listItem ) );
5273</script>
5274
5275</body>
5276</html>
5277```
5278 * @example ​ ````Returns the index for the first item in the jQuery collection.
5279```html
5280<!doctype html>
5281<html lang="en">
5282<head>
5283 <meta charset="utf-8">
5284 <title>index demo</title>
5285 <style>
5286 div {
5287 font-weight: bold;
5288 color: #090;
5289 }
5290 </style>
5291 <script src="https://code.jquery.com/jquery-3.3.1.js"></script>
5292</head>
5293<body>
5294
5295<ul>
5296 <li id="foo">foo</li>
5297 <li id="bar">bar</li>
5298 <li id="baz">baz</li>
5299</ul>
5300<div></div>
5301
5302<script>
5303var listItems = $( "li:gt(0)" );
5304$( "div" ).html( "Index: " + $( "li" ).index( listItems ) );
5305</script>
5306
5307</body>
5308</html>
5309```
5310 * @example ​ ````Returns the index for the element with ID bar in relation to all &lt;li&gt; elements.
5311```html
5312<!doctype html>
5313<html lang="en">
5314<head>
5315 <meta charset="utf-8">
5316 <title>index demo</title>
5317 <style>
5318 div {
5319 font-weight: bold;
5320 color: #090;
5321 }
5322 </style>
5323 <script src="https://code.jquery.com/jquery-3.3.1.js"></script>
5324</head>
5325<body>
5326
5327<ul>
5328 <li id="foo">foo</li>
5329 <li id="bar">bar</li>
5330 <li id="baz">baz</li>
5331</ul>
5332<div></div>
5333
5334<script>
5335$( "div" ).html( "Index: " + $( "#bar" ).index( "li" ) );
5336</script>
5337
5338</body>
5339</html>
5340```
5341 * @example ​ ````Returns the index for the element with ID bar in relation to its siblings.
5342```html
5343<!doctype html>
5344<html lang="en">
5345<head>
5346 <meta charset="utf-8">
5347 <title>index demo</title>
5348 <style>
5349 div {
5350 font-weight: bold;
5351 color: #090;
5352 }
5353 </style>
5354 <script src="https://code.jquery.com/jquery-3.3.1.js"></script>
5355</head>
5356<body>
5357
5358<ul>
5359 <li id="foo">foo</li>
5360 <li id="bar">bar</li>
5361 <li id="baz">baz</li>
5362</ul>
5363<div></div>
5364
5365<script>
5366var barIndex = $( "#bar" ).index();
5367$( "div" ).html( "Index: " + barIndex );
5368</script>
5369
5370</body>
5371</html>
5372```
5373 * @example ​ ````Returns -1, as there is no element with ID foobar.
5374```html
5375<!doctype html>
5376<html lang="en">
5377<head>
5378 <meta charset="utf-8">
5379 <title>index demo</title>
5380 <style>
5381 div {
5382 font-weight: bold;
5383 color: #090;
5384 }
5385 </style>
5386 <script src="https://code.jquery.com/jquery-3.3.1.js"></script>
5387</head>
5388<body>
5389
5390<ul>
5391 <li id="foo">foo</li>
5392 <li id="bar">bar</li>
5393 <li id="baz">baz</li>
5394</ul>
5395<div></div>
5396
5397<script>
5398var foobar = $( "li" ).index( $( "#foobar" ) );
5399$( "div" ).html( "Index: " + foobar );
5400</script>
5401
5402</body>
5403</html>
5404```
5405 */
5406 index(selector_element?: JQuery.Selector | Element | JQuery): number;
5407 /**
5408 * Set the CSS inner height of each element in the set of matched elements.
5409 * @param value_function _&#x40;param_ `value_function`
5410 * <br>
5411 * * `value` — A number representing the number of pixels, or a number along with an optional unit of measure
5412 * appended (as a string). <br>
5413 * * `function` — A function returning the inner height (including padding but not border) to set. Receives the index
5414 * position of the element in the set and the old inner height as arguments. Within the function, `this`
5415 * refers to the current element in the set.
5416 * @see \`{@link https://api.jquery.com/innerHeight/ }\`
5417 * @since 1.8.0
5418 * @example ​ ````Change the inner height of each div the first time it is clicked (and change its color).
5419```html
5420<!doctype html>
5421<html lang="en">
5422<head>
5423 <meta charset="utf-8">
5424 <title>innerHeight demo</title>
5425 <style>
5426div {
5427 width: 60px;
5428 padding: 10px;
5429 height: 70px;
5430 float: left;
5431 margin: 5px;
5432 background: red;
5433 cursor: pointer;
5434}
5435.mod {
5436 background: blue;
5437 cursor: default;
5438}
5439 </style>
5440 <script src="https://code.jquery.com/jquery-3.3.1.js"></script>
5441</head>
5442<body>
5443
5444<div>d</div>
5445<div>d</div>
5446<div>d</div>
5447<div>d</div>
5448<div>d</div>
5449
5450<script>
5451var modHeight = 70;
5452$( "div" ).one( "click", function() {
5453 $( this ).innerHeight( modHeight ).addClass( "mod" );
5454 modHeight -= 8;
5455});
5456</script>
5457
5458</body>
5459</html>
5460```
5461 */
5462 innerHeight(value_function: string | number | ((this: TElement, index: number, height: number) => string | number)): this;
5463 /**
5464 * Get the current computed height for the first element in the set of matched elements, including padding but not border.
5465 * @see \`{@link https://api.jquery.com/innerHeight/ }\`
5466 * @since 1.2.6
5467 * @example ​ ````Get the innerHeight of a paragraph.
5468```html
5469<!doctype html>
5470<html lang="en">
5471<head>
5472 <meta charset="utf-8">
5473 <title>innerHeight demo</title>
5474 <style>
5475 p {
5476 margin: 10px;
5477 padding: 5px;
5478 border: 2px solid #666;
5479 }
5480 </style>
5481 <script src="https://code.jquery.com/jquery-3.3.1.js"></script>
5482</head>
5483<body>
5484
5485<p>Hello</p>
5486<p></p>
5487
5488<script>
5489var p = $( "p:first" );
5490$( "p:last" ).text( "innerHeight:" + p.innerHeight() );
5491</script>
5492
5493</body>
5494</html>
5495```
5496 */
5497 innerHeight(): number | undefined;
5498 /**
5499 * Set the CSS inner width of each element in the set of matched elements.
5500 * @param value_function _&#x40;param_ `value_function`
5501 * <br>
5502 * * `value` — A number representing the number of pixels, or a number along with an optional unit of measure
5503 * appended (as a string). <br>
5504 * * `function` — A function returning the inner width (including padding but not border) to set. Receives the index
5505 * position of the element in the set and the old inner width as arguments. Within the function, `this`
5506 * refers to the current element in the set.
5507 * @see \`{@link https://api.jquery.com/innerWidth/ }\`
5508 * @since 1.8.0
5509 * @example ​ ````Change the inner width of each div the first time it is clicked (and change its color).
5510```html
5511<!doctype html>
5512<html lang="en">
5513<head>
5514 <meta charset="utf-8">
5515 <title>innerWidth demo</title>
5516 <style>
5517div {
5518width: 60px;
5519padding: 10px;
5520height: 50px;
5521float: left;
5522margin: 5px;
5523background: red;
5524cursor: pointer;
5525}
5526.mod {
5527background: blue;
5528cursor: default;
5529}
5530 </style>
5531 <script src="https://code.jquery.com/jquery-3.3.1.js"></script>
5532</head>
5533<body>
5534
5535<div>d</div>
5536<div>d</div>
5537<div>d</div>
5538<div>d</div>
5539<div>d</div>
5540
5541<script>
5542var modWidth = 60;
5543$( "div" ).one( "click", function() {
5544$( this ).innerWidth( modWidth ).addClass( "mod" );
5545modWidth -= 8;
5546});
5547</script>
5548
5549</body>
5550</html>
5551```
5552 */
5553 innerWidth(value_function: string | number | ((this: TElement, index: number, width: number) => string | number)): this;
5554 /**
5555 * Get the current computed inner width for the first element in the set of matched elements, including padding but not border.
5556 * @see \`{@link https://api.jquery.com/innerWidth/ }\`
5557 * @since 1.2.6
5558 * @example ​ ````Get the innerWidth of a paragraph.
5559```html
5560<!doctype html>
5561<html lang="en">
5562<head>
5563 <meta charset="utf-8">
5564 <title>innerWidth demo</title>
5565 <style>
5566 p {
5567 margin: 10px;
5568 padding: 5px;
5569 border: 2px solid #666;
5570 }
5571 </style>
5572 <script src="https://code.jquery.com/jquery-3.3.1.js"></script>
5573</head>
5574<body>
5575
5576<p>Hello</p>
5577<p></p>
5578
5579<script>
5580var p = $( "p:first" );
5581$( "p:last" ).text( "innerWidth:" + p.innerWidth() );
5582</script>
5583
5584</body>
5585</html>
5586```
5587 */
5588 innerWidth(): number | undefined;
5589 /**
5590 * Insert every element in the set of matched elements after the target.
5591 * @param target A selector, element, array of elements, HTML string, or jQuery object; the matched set of elements
5592 * will be inserted after the element(s) specified by this parameter.
5593 * @see \`{@link https://api.jquery.com/insertAfter/ }\`
5594 * @since 1.0
5595 * @example ​ ````Insert all paragraphs after an element with id of &quot;foo&quot;. Same as $( &quot;#foo&quot; ).after( &quot;p&quot; )
5596```html
5597<!doctype html>
5598<html lang="en">
5599<head>
5600 <meta charset="utf-8">
5601 <title>insertAfter demo</title>
5602 <style>
5603 #foo {
5604 background: yellow;
5605 }
5606 </style>
5607 <script src="https://code.jquery.com/jquery-3.3.1.js"></script>
5608</head>
5609<body>
5610
5611<p> is what I said... </p>
5612<div id="foo">FOO!</div>
5613
5614<script>
5615$( "p" ).insertAfter( "#foo" );
5616</script>
5617
5618</body>
5619</html>
5620```
5621 */
5622 insertAfter(target: JQuery.Selector | JQuery.htmlString | JQuery.TypeOrArray<Node> | JQuery<Node>): this;
5623 /**
5624 * Insert every element in the set of matched elements before the target.
5625 * @param target A selector, element, array of elements, HTML string, or jQuery object; the matched set of elements
5626 * will be inserted before the element(s) specified by this parameter.
5627 * @see \`{@link https://api.jquery.com/insertBefore/ }\`
5628 * @since 1.0
5629 * @example ​ ````Insert all paragraphs before an element with id of &quot;foo&quot;. Same as $( &quot;#foo&quot; ).before( &quot;p&quot; )
5630```html
5631<!doctype html>
5632<html lang="en">
5633<head>
5634 <meta charset="utf-8">
5635 <title>insertBefore demo</title>
5636 <style>
5637 #foo {
5638 background: yellow;
5639 }
5640 </style>
5641 <script src="https://code.jquery.com/jquery-3.3.1.js"></script>
5642</head>
5643<body>
5644
5645<div id="foo">FOO!</div>
5646<p>I would like to say: </p>
5647
5648<script>
5649$( "p" ).insertBefore( "#foo" );
5650</script>
5651
5652</body>
5653</html>
5654```
5655 */
5656 insertBefore(target: JQuery.Selector | JQuery.htmlString | JQuery.TypeOrArray<Node> | JQuery<Node>): this;
5657 /**
5658 * Check the current matched set of elements against a selector, element, or jQuery object and return true if at least one of these elements matches the given arguments.
5659 * @param selector_function_selection_elements _&#x40;param_ `selector_function_selection_elements`
5660 * <br>
5661 * * `selector` — A string containing a selector expression to match elements against. <br>
5662 * * `function` — A function used as a test for every element in the set. It accepts two arguments, `index`, which is
5663 * the element's index in the jQuery collection, and `element`, which is the DOM element. Within the
5664 * function, `this` refers to the current DOM element. <br>
5665 * * `selection` — An existing jQuery object to match the current set of elements against. <br>
5666 * * `elements` — One or more elements to match the current set of elements against.
5667 * @see \`{@link https://api.jquery.com/is/ }\`
5668 * @since 1.0
5669 * @since 1.6
5670 * @example ​ ````Shows a few ways is() can be used inside an event handler.
5671```html
5672<!doctype html>
5673<html lang="en">
5674<head>
5675 <meta charset="utf-8">
5676 <title>is demo</title>
5677 <style>
5678 div {
5679 width: 60px;
5680 height: 60px;
5681 margin: 5px;
5682 float: left;
5683 border: 4px outset;
5684 background: green;
5685 text-align: center;
5686 font-weight: bolder;
5687 cursor: pointer;
5688 }
5689 .blue {
5690 background: blue;
5691 }
5692 .red {
5693 background: red;
5694 }
5695 span {
5696 color: white;
5697 font-size: 16px;
5698 }
5699 p {
5700 color: red;
5701 font-weight: bolder;
5702 background: yellow;
5703 margin: 3px;
5704 clear: left;
5705 display: none;
5706 }
5707 </style>
5708 <script src="https://code.jquery.com/jquery-3.3.1.js"></script>
5709</head>
5710<body>
5711
5712<div></div>
5713<div class="blue"></div>
5714<div></div>
5715<div class="red"></div>
5716<div><br/><span>Peter</span></div>
5717<div class="blue"></div>
5718<p>&nbsp;</p>
5719
5720<script>
5721$( "div" ).one( "click", function() {
5722 if ( $( this ).is( ":first-child" ) ) {
5723 $( "p" ).text( "It's the first div." );
5724 } else if ( $( this ).is( ".blue,.red" ) ) {
5725 $( "p" ).text( "It's a blue or red div." );
5726 } else if ( $( this ).is( ":contains('Peter')" ) ) {
5727 $( "p" ).text( "It's Peter!" );
5728 } else {
5729 $( "p" ).html( "It's nothing <em>special</em>." );
5730 }
5731 $( "p" ).hide().slideDown( "slow" );
5732 $( this ).css({
5733 "border-style": "inset",
5734 cursor: "default"
5735 });
5736});
5737</script>
5738
5739</body>
5740</html>
5741```
5742 * @example ​ ````Returns true, because the parent of the input is a form element.
5743```html
5744<!doctype html>
5745<html lang="en">
5746<head>
5747 <meta charset="utf-8">
5748 <title>is demo</title>
5749 <style>
5750 div {
5751 color: red;
5752 }
5753 </style>
5754 <script src="https://code.jquery.com/jquery-3.3.1.js"></script>
5755</head>
5756<body>
5757
5758<form>
5759 <input type="checkbox">
5760</form>
5761<div></div>
5762
5763<script>
5764var isFormParent = $( "input[type='checkbox']" ).parent().is( "form" );
5765$( "div" ).text( "isFormParent = " + isFormParent );
5766</script>
5767
5768</body>
5769</html>
5770```
5771 * @example ​ ````Returns false, because the parent of the input is a p element.
5772```html
5773<!doctype html>
5774<html lang="en">
5775<head>
5776 <meta charset="utf-8">
5777 <title>is demo</title>
5778 <style>
5779 div {
5780 color: red;
5781 }
5782 </style>
5783 <script src="https://code.jquery.com/jquery-3.3.1.js"></script>
5784</head>
5785<body>
5786
5787<form>
5788 <p><input type="checkbox"></p>
5789</form>
5790<div></div>
5791
5792<script>
5793var isFormParent = $( "input[type='checkbox']" ).parent().is( "form" );
5794$( "div" ).text( "isFormParent = " + isFormParent );
5795</script>
5796
5797</body>
5798</html>
5799```
5800 * @example ​ ````Checks against an existing collection of alternating list elements. Blue, alternating list elements slide up while others turn red.
5801```html
5802<!doctype html>
5803<html lang="en">
5804<head>
5805 <meta charset="utf-8">
5806 <title>is demo</title>
5807 <style>
5808 li {
5809 cursor: pointer;
5810 }
5811 </style>
5812 <script src="https://code.jquery.com/jquery-3.3.1.js"></script>
5813</head>
5814<body>
5815
5816<ul id="browsers">
5817 <li>Chrome</li>
5818 <li>Safari</li>
5819 <li>Firefox</li>
5820 <li>Opera</li>
5821</ul>
5822
5823<script>
5824var alt = $( "#browsers li:nth-child(2n)" ).css( "background", "#0ff" );
5825$( "li" ).click(function() {
5826 var li = $( this );
5827 if ( li.is( alt ) ) {
5828 li.slideUp();
5829 } else {
5830 li.css( "background", "red" );
5831 }
5832});
5833</script>
5834
5835</body>
5836</html>
5837```
5838 * @example ​ ````An alternate way to achieve the above example using an element rather than a jQuery object. Checks against an existing collection of alternating list elements. Blue, alternating list elements slide up while others turn red.
5839```html
5840<!doctype html>
5841<html lang="en">
5842<head>
5843 <meta charset="utf-8">
5844 <title>is demo</title>
5845 <style>
5846 li {
5847 cursor: pointer;
5848 }
5849 </style>
5850 <script src="https://code.jquery.com/jquery-3.3.1.js"></script>
5851</head>
5852<body>
5853
5854<ul id="browsers">
5855 <li>Chrome</li>
5856 <li>Safari</li>
5857 <li>Firefox</li>
5858 <li>Opera</li>
5859</ul>
5860
5861<script>
5862var alt = $( "#browsers li:nth-child(2n)" ).css( "background", "#0ff" );
5863$( "li" ).click(function() {
5864 if ( alt.is( this ) ) {
5865 $( this ).slideUp();
5866 } else {
5867 $( this ).css( "background", "red" );
5868 }
5869});
5870</script>
5871
5872</body>
5873</html>
5874```
5875 */
5876 is(selector_function_selection_elements: JQuery.Selector | JQuery.TypeOrArray<Element> | JQuery | ((this: TElement, index: number, element: TElement) => boolean)): boolean;
5877 /**
5878 * Bind an event handler to the "keydown" JavaScript event, or trigger that event on an element.
5879 * @param eventData An object containing data that will be passed to the event handler.
5880 * @param handler A function to execute each time the event is triggered.
5881 * @see \`{@link https://api.jquery.com/keydown/ }\`
5882 * @since 1.4.3
5883 * @deprecatedDeprecated since 3.3. Use \`{@link on }\` or \`{@link trigger }\`.
5884 *
5885 * **Cause**: The `.on()` and `.trigger()` methods can set an event handler or generate an event for any event type, and should be used instead of the shortcut methods. This message also applies to the other event shorthands, including: blur, focus, focusin, focusout, resize, scroll, dblclick, mousedown, mouseup, mousemove, mouseover, mouseout, mouseenter, mouseleave, change, select, submit, keydown, keypress, keyup, and contextmenu.
5886 *
5887 * **Solution**: Instead of `.click(fn)` use `.on("click", fn)`. Instead of `.click()` use `.trigger("click")`.
5888 */
5889 keydown<TData>(eventData: TData,
5890 handler: JQuery.TypeEventHandler<TElement, TData, TElement, TElement, 'keydown'>): this;
5891 /**
5892 * Bind an event handler to the "keydown" JavaScript event, or trigger that event on an element.
5893 * @param handler A function to execute each time the event is triggered.
5894 * @see \`{@link https://api.jquery.com/keydown/ }\`
5895 * @since 1.0
5896 * @deprecatedDeprecated since 3.3. Use \`{@link on }\` or \`{@link trigger }\`.
5897 *
5898 * **Cause**: The `.on()` and `.trigger()` methods can set an event handler or generate an event for any event type, and should be used instead of the shortcut methods. This message also applies to the other event shorthands, including: blur, focus, focusin, focusout, resize, scroll, dblclick, mousedown, mouseup, mousemove, mouseover, mouseout, mouseenter, mouseleave, change, select, submit, keydown, keypress, keyup, and contextmenu.
5899 *
5900 * **Solution**: Instead of `.click(fn)` use `.on("click", fn)`. Instead of `.click()` use `.trigger("click")`.
5901 * @example ​ ````Show the event object for the keydown handler when a key is pressed in the input.
5902```html
5903<!doctype html>
5904<html lang="en">
5905<head>
5906 <meta charset="utf-8">
5907 <title>keydown demo</title>
5908 <style>
5909 fieldset {
5910 margin-bottom: 1em;
5911 }
5912 input {
5913 display: block;
5914 margin-bottom: .25em;
5915 }
5916 #print-output {
5917 width: 100%;
5918 }
5919 .print-output-line {
5920 white-space: pre;
5921 padding: 5px;
5922 font-family: monaco, monospace;
5923 font-size: .7em;
5924 }
5925 </style>
5926 <script src="https://code.jquery.com/jquery-3.3.1.js"></script>
5927</head>
5928<body>
5929
5930<form>
5931 <fieldset>
5932 <label for="target">Type Something:</label>
5933 <input id="target" type="text">
5934 </fieldset>
5935</form>
5936<button id="other">
5937 Trigger the handler
5938</button>
5939<script type="text/javascript" src="/resources/events.js"></script>
5940
5941<script>
5942var xTriggered = 0;
5943$( "#target" ).keydown(function( event ) {
5944 if ( event.which == 13 ) {
5945 event.preventDefault();
5946 }
5947 xTriggered++;
5948 var msg = "Handler for .keydown() called " + xTriggered + " time(s).";
5949 $.print( msg, "html" );
5950 $.print( event );
5951});
5952
5953$( "#other" ).click(function() {
5954 $( "#target" ).keydown();
5955});
5956</script>
5957
5958</body>
5959</html>
5960```
5961 */
5962 keydown(handler?: JQuery.TypeEventHandler<TElement, null, TElement, TElement, 'keydown'> |
5963 false): this;
5964 /**
5965 * Bind an event handler to the "keypress" JavaScript event, or trigger that event on an element.
5966 * @param eventData An object containing data that will be passed to the event handler.
5967 * @param handler A function to execute each time the event is triggered.
5968 * @see \`{@link https://api.jquery.com/keypress/ }\`
5969 * @since 1.4.3
5970 * @deprecatedDeprecated since 3.3. Use \`{@link on }\` or \`{@link trigger }\`.
5971 *
5972 * **Cause**: The `.on()` and `.trigger()` methods can set an event handler or generate an event for any event type, and should be used instead of the shortcut methods. This message also applies to the other event shorthands, including: blur, focus, focusin, focusout, resize, scroll, dblclick, mousedown, mouseup, mousemove, mouseover, mouseout, mouseenter, mouseleave, change, select, submit, keydown, keypress, keyup, and contextmenu.
5973 *
5974 * **Solution**: Instead of `.click(fn)` use `.on("click", fn)`. Instead of `.click()` use `.trigger("click")`.
5975 */
5976 keypress<TData>(eventData: TData,
5977 handler: JQuery.TypeEventHandler<TElement, TData, TElement, TElement, 'keypress'>): this;
5978 /**
5979 * Bind an event handler to the "keypress" JavaScript event, or trigger that event on an element.
5980 * @param handler A function to execute each time the event is triggered.
5981 * @see \`{@link https://api.jquery.com/keypress/ }\`
5982 * @since 1.0
5983 * @deprecatedDeprecated since 3.3. Use \`{@link on }\` or \`{@link trigger }\`.
5984 *
5985 * **Cause**: The `.on()` and `.trigger()` methods can set an event handler or generate an event for any event type, and should be used instead of the shortcut methods. This message also applies to the other event shorthands, including: blur, focus, focusin, focusout, resize, scroll, dblclick, mousedown, mouseup, mousemove, mouseover, mouseout, mouseenter, mouseleave, change, select, submit, keydown, keypress, keyup, and contextmenu.
5986 *
5987 * **Solution**: Instead of `.click(fn)` use `.on("click", fn)`. Instead of `.click()` use `.trigger("click")`.
5988 * @example ​ ````Show the event object when a key is pressed in the input. Note: This demo relies on a simple $.print() plugin (https://api.jquery.com/resources/events.js) for the event object&#39;s output.
5989```html
5990<!doctype html>
5991<html lang="en">
5992<head>
5993 <meta charset="utf-8">
5994 <title>keypress demo</title>
5995 <style>
5996 fieldset {
5997 margin-bottom: 1em;
5998 }
5999 input {
6000 display: block;
6001 margin-bottom: .25em;
6002 }
6003 #print-output {
6004 width: 100%;
6005 }
6006 .print-output-line {
6007 white-space: pre;
6008 padding: 5px;
6009 font-family: monaco, monospace;
6010 font-size: .7em;
6011 }
6012 </style>
6013 <script src="https://code.jquery.com/jquery-3.3.1.js"></script>
6014</head>
6015<body>
6016
6017<form>
6018 <fieldset>
6019 <label for="target">Type Something:</label>
6020 <input id="target" type="text">
6021 </fieldset>
6022</form>
6023<button id="other">
6024 Trigger the handler
6025</button>
6026<script src="/resources/events.js"></script>
6027
6028<script>
6029var xTriggered = 0;
6030$( "#target" ).keypress(function( event ) {
6031 if ( event.which == 13 ) {
6032 event.preventDefault();
6033 }
6034 xTriggered++;
6035 var msg = "Handler for .keypress() called " + xTriggered + " time(s).";
6036 $.print( msg, "html" );
6037 $.print( event );
6038});
6039
6040$( "#other" ).click(function() {
6041 $( "#target" ).keypress();
6042});
6043</script>
6044
6045</body>
6046</html>
6047```
6048 */
6049 keypress(handler?: JQuery.TypeEventHandler<TElement, null, TElement, TElement, 'keypress'> |
6050 false): this;
6051 /**
6052 * Bind an event handler to the "keyup" JavaScript event, or trigger that event on an element.
6053 * @param eventData An object containing data that will be passed to the event handler.
6054 * @param handler A function to execute each time the event is triggered.
6055 * @see \`{@link https://api.jquery.com/keyup/ }\`
6056 * @since 1.4.3
6057 * @deprecated ​ Deprecated since 3.3. Use \`{@link on }\` or \`{@link trigger }\`.
6058 *
6059 * **Cause**: The `.on()` and `.trigger()` methods can set an event handler or generate an event for any event type, and should be used instead of the shortcut methods. This message also applies to the other event shorthands, including: blur, focus, focusin, focusout, resize, scroll, dblclick, mousedown, mouseup, mousemove, mouseover, mouseout, mouseenter, mouseleave, change, select, submit, keydown, keypress, keyup, and contextmenu.
6060 *
6061 * **Solution**: Instead of `.click(fn)` use `.on("click", fn)`. Instead of `.click()` use `.trigger("click")`.
6062 */
6063 keyup<TData>(eventData: TData,
6064 handler: JQuery.TypeEventHandler<TElement, TData, TElement, TElement, 'keyup'>): this;
6065 /**
6066 * Bind an event handler to the "keyup" JavaScript event, or trigger that event on an element.
6067 * @param handler A function to execute each time the event is triggered.
6068 * @see \`{@link https://api.jquery.com/keyup/ }\`
6069 * @since 1.0
6070 * @deprecated ​ Deprecated since 3.3. Use \`{@link on }\` or \`{@link trigger }\`.
6071 *
6072 * **Cause**: The `.on()` and `.trigger()` methods can set an event handler or generate an event for any event type, and should be used instead of the shortcut methods. This message also applies to the other event shorthands, including: blur, focus, focusin, focusout, resize, scroll, dblclick, mousedown, mouseup, mousemove, mouseover, mouseout, mouseenter, mouseleave, change, select, submit, keydown, keypress, keyup, and contextmenu.
6073 *
6074 * **Solution**: Instead of `.click(fn)` use `.on("click", fn)`. Instead of `.click()` use `.trigger("click")`.
6075 * @example ​ ````Show the event object for the keyup handler (using a simple $.print plugin) when a key is released in the input.
6076```html
6077<!doctype html>
6078<html lang="en">
6079<head>
6080 <meta charset="utf-8">
6081 <title>keyup demo</title>
6082 <style>
6083 fieldset {
6084 margin-bottom: 1em;
6085 }
6086 input {
6087 display: block;
6088 margin-bottom: .25em;
6089 }
6090 #print-output {
6091 width: 100%;
6092 }
6093 .print-output-line {
6094 white-space: pre;
6095 padding: 5px;
6096 font-family: monaco, monospace;
6097 font-size: .7em;
6098 }
6099 </style>
6100 <script src="https://code.jquery.com/jquery-3.3.1.js"></script>
6101</head>
6102<body>
6103
6104<form>
6105 <fieldset>
6106 <label for="target">Type Something:</label>
6107 <input id="target" type="text">
6108 </fieldset>
6109</form>
6110<button id="other">
6111 Trigger the handler
6112</button>
6113<script type="text/javascript" src="/resources/events.js"></script>
6114
6115<script>
6116var xTriggered = 0;
6117$( "#target" ).keyup(function( event ) {
6118 xTriggered++;
6119 var msg = "Handler for .keyup() called " + xTriggered + " time(s).";
6120 $.print( msg, "html" );
6121 $.print( event );
6122}).keydown(function( event ) {
6123 if ( event.which == 13 ) {
6124 event.preventDefault();
6125 }
6126});
6127
6128$( "#other").click(function() {
6129 $( "#target" ).keyup();
6130});
6131</script>
6132
6133</body>
6134</html>
6135```
6136 */
6137 keyup(handler?: JQuery.TypeEventHandler<TElement, null, TElement, TElement, 'keyup'> |
6138 false): this;
6139 /**
6140 * Reduce the set of matched elements to the final one in the set.
6141 * @see \`{@link https://api.jquery.com/last/ }\`
6142 * @since 1.4
6143 * @example ​ ````Highlight the last span in a paragraph.
6144```html
6145<!doctype html>
6146<html lang="en">
6147<head>
6148 <meta charset="utf-8">
6149 <title>last demo</title>
6150 <style>
6151 .highlight {
6152 background-color: yellow;
6153 }
6154 </style>
6155 <script src="https://code.jquery.com/jquery-3.3.1.js"></script>
6156</head>
6157<body>
6158
6159<p><span>Look:</span> <span>This is some text in a paragraph.</span> <span>This is a note about it.</span></p>
6160
6161<script>
6162$( "p span" ).last().addClass( "highlight" );
6163</script>
6164
6165</body>
6166</html>
6167```
6168 */
6169 last(): this;
6170
6171 /**
6172 * Reduce the set of matched elements to the even ones in the set, numbered from zero.
6173 * @see \`{@link https://api.jquery.com/even/ }\`
6174 * @since 3.5
6175 * @example ​ ````Highlight the even items in a list.
6176```html
6177<!doctype html>
6178<html lang="en">
6179<head>
6180 <meta charset="utf-8">
6181 <title>even demo</title>
6182 <style>
6183 .highlight {
6184 background-color: yellow;
6185 }
6186 </style>
6187 <script src="https://code.jquery.com/jquery-3.5.0.js"></script>
6188</head>
6189<body>
6190
6191<ul>
6192 <li>Look:</li>
6193 <li>This is some text in a list.</li>
6194 <li>This is a note about it.</li>
6195 <li>This is another note about it.</li>
6196</ul>
6197
6198<script>
6199$( "ul li" ).even().addClass( "highlight" );
6200</script>
6201
6202</body>
6203</html>
6204```
6205 */
6206 even(): this;
6207
6208 /**
6209 * Reduce the set of matched elements to the odd ones in the set, numbered from zero.
6210 * @see \`{@link https://api.jquery.com/odd/ }\`
6211 * @since 3.5
6212 * @example ​ ````Highlight the odd items in a list.
6213```html
6214<!doctype html>
6215<html lang="en">
6216<head>
6217 <meta charset="utf-8">
6218 <title>odd demo</title>
6219 <style>
6220 .highlight {
6221 background-color: yellow;
6222 }
6223 </style>
6224 <script src="https://code.jquery.com/jquery-3.5.0.js"></script>
6225</head>
6226<body>
6227
6228<ul>
6229 <li>Look:</li>
6230 <li>This is some text in a list.</li>
6231 <li>This is a note about it.</li>
6232 <li>This is another note about it.</li>
6233</ul>
6234
6235<script>
6236$( "ul li" ).odd().addClass( "highlight" );
6237</script>
6238
6239</body>
6240</html>
6241```
6242 */
6243 odd(): this;
6244
6245 /**
6246 * Load data from the server and place the returned HTML into the matched element.
6247 * @param url A string containing the URL to which the request is sent.
6248 * @param data A plain object or string that is sent to the server with the request.
6249 * @param complete A callback function that is executed when the request completes.
6250 * @see \`{@link https://api.jquery.com/load/ }\`
6251 * @since 1.0
6252 * @example ​ ````Same as above, but will POST the additional parameters to the server and a callback that is executed when the server is finished responding.
6253```javascript
6254$( "#feeds" ).load( "feeds.php", { limit: 25 }, function() {
6255 alert( "The last 25 entries in the feed have been loaded" );
6256});
6257```
6258 */
6259 load(url: string,
6260 data: string | JQuery.PlainObject,
6261 complete: (this: TElement, responseText: string, textStatus: JQuery.Ajax.TextStatus, jqXHR: JQuery.jqXHR) => void): this;
6262 /**
6263 * Load data from the server and place the returned HTML into the matched element.
6264 * @param url A string containing the URL to which the request is sent.
6265 * @param complete_data _&#x40;param_ `complete_data`
6266 * <br>
6267 * * `complete` — A callback function that is executed when the request completes. <br>
6268 * * `data` — A plain object or string that is sent to the server with the request.
6269 * @see \`{@link https://api.jquery.com/load/ }\`
6270 * @since 1.0
6271 * @example ​ ````Load another page&#39;s list items into an ordered list.
6272```html
6273<!doctype html>
6274<html lang="en">
6275<head>
6276 <meta charset="utf-8">
6277 <title>load demo</title>
6278 <style>
6279 body {
6280 font-size: 12px;
6281 font-family: Arial;
6282 }
6283 </style>
6284 <script src="https://code.jquery.com/jquery-3.3.1.js"></script>
6285</head>
6286<body>
6287
6288<b>Projects:</b>
6289<ol id="new-projects"></ol>
6290
6291<script>
6292$( "#new-projects" ).load( "/resources/load.html #projects li" );
6293</script>
6294
6295</body>
6296</html>
6297```
6298 * @example ​ ````Display a notice if the Ajax request encounters an error.
6299```html
6300<!doctype html>
6301<html lang="en">
6302<head>
6303 <meta charset="utf-8">
6304 <title>load demo</title>
6305 <style>
6306 body {
6307 font-size: 12px;
6308 font-family: Arial;
6309 }
6310 </style>
6311 <script src="https://code.jquery.com/jquery-3.3.1.js"></script>
6312</head>
6313<body>
6314
6315<b>Successful Response (should be blank):</b>
6316<div id="success"></div>
6317<b>Error Response:</b>
6318<div id="error"></div>
6319
6320<script>
6321$( "#success" ).load( "/not-here.php", function( response, status, xhr ) {
6322 if ( status == "error" ) {
6323 var msg = "Sorry but there was an error: ";
6324 $( "#error" ).html( msg + xhr.status + " " + xhr.statusText );
6325 }
6326});
6327</script>
6328
6329</body>
6330</html>
6331```
6332 * @example ​ ````Load the feeds.html file into the div with the ID of feeds.
6333```javascript
6334$( "#feeds" ).load( "feeds.html" );
6335```
6336 * @example ​ ````pass arrays of data to the server.
6337```javascript
6338$( "#objectID" ).load( "test.php", { "choices[]": [ "Jon", "Susan" ] } );
6339```
6340 */
6341 load(url: string,
6342 complete_data?: ((this: TElement, responseText: string, textStatus: JQuery.Ajax.TextStatus, jqXHR: JQuery.jqXHR) => void) | string | JQuery.PlainObject): this;
6343 /**
6344 * Pass each element in the current matched set through a function, producing a new jQuery object containing the return values.
6345 * @param callback A function object that will be invoked for each element in the current set.
6346 * @see \`{@link https://api.jquery.com/map/ }\`
6347 * @since 1.2
6348 * @example ​ ````Build a list of all the values within a form.
6349```html
6350<!doctype html>
6351<html lang="en">
6352<head>
6353 <meta charset="utf-8">
6354 <title>map demo</title>
6355 <style>
6356 p {
6357 color: red;
6358 }
6359 </style>
6360 <script src="https://code.jquery.com/jquery-3.3.1.js"></script>
6361</head>
6362<body>
6363
6364<p><b>Values: </b></p>
6365<form>
6366 <input type="text" name="name" value="John">
6367 <input type="text" name="password" value="password">
6368 <input type="text" name="url" value="https://johnresig.com/">
6369</form>
6370
6371<script>
6372$( "p" )
6373 .append( $( "input" ).map(function() {
6374 return $( this ).val();
6375 })
6376 .get()
6377 .join( ", " ) );
6378</script>
6379
6380</body>
6381</html>
6382```
6383 * @example ​ ````A contrived example to show some functionality.
6384```html
6385<!doctype html>
6386<html lang="en">
6387<head>
6388 <meta charset="utf-8">
6389 <title>map demo</title>
6390 <style>
6391 body {
6392 font-size: 16px;
6393 }
6394 ul {
6395 float: left;
6396 margin: 0 30px;
6397 color: blue;
6398 }
6399 #results {
6400 color: red;
6401 }
6402 </style>
6403 <script src="https://code.jquery.com/jquery-3.3.1.js"></script>
6404</head>
6405<body>
6406
6407<ul>
6408 <li>First</li>
6409 <li>Second</li>
6410 <li>Third</li>
6411 <li>Fourth</li>
6412 <li>Fifth</li>
6413</ul>
6414<ul id="results">
6415</ul>
6416
6417<script>
6418var mappedItems = $( "li" ).map(function( index ) {
6419 var replacement = $( "<li>" ).text( $( this ).text() ).get( 0 );
6420 if ( index === 0 ) {
6421
6422 // Make the first item all caps
6423 $( replacement ).text( $( replacement ).text().toUpperCase() );
6424 } else if ( index === 1 || index === 3 ) {
6425
6426 // Delete the second and fourth items
6427 replacement = null;
6428 } else if ( index === 2 ) {
6429
6430 // Make two of the third item and add some text
6431 replacement = [ replacement, $( "<li>" ).get( 0 ) ];
6432 $( replacement[ 0 ] ).append( "<b> - A</b>" );
6433 $( replacement[ 1 ] ).append( "Extra <b> - B</b>" );
6434 }
6435
6436 // Replacement will be a dom element, null,
6437 // or an array of dom elements
6438 return replacement;
6439});
6440$( "#results" ).append( mappedItems );
6441</script>
6442
6443</body>
6444</html>
6445```
6446 * @example ​ ````Equalize the heights of the divs.
6447```html
6448<!doctype html>
6449<html lang="en">
6450<head>
6451 <meta charset="utf-8">
6452 <title>map demo</title>
6453 <style>
6454 div {
6455 width: 40px;
6456 float: left;
6457 }
6458 input {
6459 clear: left;
6460 }
6461 </style>
6462 <script src="https://code.jquery.com/jquery-3.3.1.js"></script>
6463</head>
6464<body>
6465
6466<input type="button" value="equalize div heights">
6467<div style="background: red; height: 40px; "></div>
6468<div style="background: green; height: 70px;"></div>
6469<div style="background: blue; height: 50px; "></div>
6470
6471<script>
6472$.fn.equalizeHeights = function() {
6473 var maxHeight = this.map(function( i, e ) {
6474 return $( e ).height();
6475 }).get();
6476 return this.height( Math.max.apply( this, maxHeight ) );
6477};
6478
6479$( "input" ).click(function() {
6480 $( "div" ).equalizeHeights();
6481});
6482</script>
6483
6484</body>
6485</html>
6486```
6487 */
6488 map<TReturn>(callback: (this: TElement, index: number, domElement: TElement) => JQuery.TypeOrArray<TReturn> | null | undefined): JQuery<TReturn>;
6489 /**
6490 * Bind an event handler to the "mousedown" JavaScript event, or trigger that event on an element.
6491 * @param eventData An object containing data that will be passed to the event handler.
6492 * @param handler A function to execute each time the event is triggered.
6493 * @see \`{@link https://api.jquery.com/mousedown/ }\`
6494 * @since 1.4.3
6495 * @deprecated ​ Deprecated since 3.3. Use \`{@link on }\` or \`{@link trigger }\`.
6496 *
6497 * **Cause**: The `.on()` and `.trigger()` methods can set an event handler or generate an event for any event type, and should be used instead of the shortcut methods. This message also applies to the other event shorthands, including: blur, focus, focusin, focusout, resize, scroll, dblclick, mousedown, mouseup, mousemove, mouseover, mouseout, mouseenter, mouseleave, change, select, submit, keydown, keypress, keyup, and contextmenu.
6498 *
6499 * **Solution**: Instead of `.click(fn)` use `.on("click", fn)`. Instead of `.click()` use `.trigger("click")`.
6500 */
6501 mousedown<TData>(eventData: TData,
6502 handler: JQuery.TypeEventHandler<TElement, TData, TElement, TElement, 'mousedown'>): this;
6503 /**
6504 * Bind an event handler to the "mousedown" JavaScript event, or trigger that event on an element.
6505 * @param handler A function to execute each time the event is triggered.
6506 * @see \`{@link https://api.jquery.com/mousedown/ }\`
6507 * @since 1.0
6508 * @deprecated ​ Deprecated since 3.3. Use \`{@link on }\` or \`{@link trigger }\`.
6509 *
6510 * **Cause**: The `.on()` and `.trigger()` methods can set an event handler or generate an event for any event type, and should be used instead of the shortcut methods. This message also applies to the other event shorthands, including: blur, focus, focusin, focusout, resize, scroll, dblclick, mousedown, mouseup, mousemove, mouseover, mouseout, mouseenter, mouseleave, change, select, submit, keydown, keypress, keyup, and contextmenu.
6511 *
6512 * **Solution**: Instead of `.click(fn)` use `.on("click", fn)`. Instead of `.click()` use `.trigger("click")`.
6513 * @example ​ ````Show texts when mouseup and mousedown event triggering.
6514```html
6515<!doctype html>
6516<html lang="en">
6517<head>
6518 <meta charset="utf-8">
6519 <title>mousedown demo</title>
6520 <script src="https://code.jquery.com/jquery-3.3.1.js"></script>
6521</head>
6522<body>
6523
6524<p>Press mouse and release here.</p>
6525
6526<script>
6527$( "p" )
6528 .mouseup(function() {
6529 $( this ).append( "<span style='color:#f00;'>Mouse up.</span>" );
6530 })
6531 .mousedown(function() {
6532 $( this ).append( "<span style='color:#00f;'>Mouse down.</span>" );
6533 });
6534</script>
6535
6536</body>
6537</html>
6538```
6539 */
6540 mousedown(handler?: JQuery.TypeEventHandler<TElement, null, TElement, TElement, 'mousedown'> |
6541 false): this;
6542 /**
6543 * Bind an event handler to be fired when the mouse enters an element, or trigger that handler on an element.
6544 * @param eventData An object containing data that will be passed to the event handler.
6545 * @param handler A function to execute each time the event is triggered.
6546 * @see \`{@link https://api.jquery.com/mouseenter/ }\`
6547 * @since 1.4.3
6548 * @deprecated ​ Deprecated since 3.3. Use \`{@link on }\` or \`{@link trigger }\`.
6549 *
6550 * **Cause**: The `.on()` and `.trigger()` methods can set an event handler or generate an event for any event type, and should be used instead of the shortcut methods. This message also applies to the other event shorthands, including: blur, focus, focusin, focusout, resize, scroll, dblclick, mousedown, mouseup, mousemove, mouseover, mouseout, mouseenter, mouseleave, change, select, submit, keydown, keypress, keyup, and contextmenu.
6551 *
6552 * **Solution**: Instead of `.click(fn)` use `.on("click", fn)`. Instead of `.click()` use `.trigger("click")`.
6553 */
6554 mouseenter<TData>(eventData: TData,
6555 handler: JQuery.TypeEventHandler<TElement, TData, TElement, TElement, 'mouseenter'>): this;
6556 /**
6557 * Bind an event handler to be fired when the mouse enters an element, or trigger that handler on an element.
6558 * @param handler A function to execute each time the event is triggered.
6559 * @see \`{@link https://api.jquery.com/mouseenter/ }\`
6560 * @since 1.0
6561 * @deprecated ​ Deprecated since 3.3. Use \`{@link on }\` or \`{@link trigger }\`.
6562 *
6563 * **Cause**: The `.on()` and `.trigger()` methods can set an event handler or generate an event for any event type, and should be used instead of the shortcut methods. This message also applies to the other event shorthands, including: blur, focus, focusin, focusout, resize, scroll, dblclick, mousedown, mouseup, mousemove, mouseover, mouseout, mouseenter, mouseleave, change, select, submit, keydown, keypress, keyup, and contextmenu.
6564 *
6565 * **Solution**: Instead of `.click(fn)` use `.on("click", fn)`. Instead of `.click()` use `.trigger("click")`.
6566 * @example ​ ````Show texts when mouseenter and mouseout event triggering.
6567 mouseover fires when the pointer moves into the child element as well, while mouseenter fires only when the pointer moves into the bound element.
6568```html
6569<!doctype html>
6570<html lang="en">
6571<head>
6572 <meta charset="utf-8">
6573 <title>mouseenter demo</title>
6574 <style>
6575 div.out {
6576 width: 40%;
6577 height: 120px;
6578 margin: 0 15px;
6579 background-color: #d6edfc;
6580 float: left;
6581 }
6582 div.in {
6583 width: 60%;
6584 height: 60%;
6585 background-color: #fc0;
6586 margin: 10px auto;
6587 }
6588 p {
6589 line-height: 1em;
6590 margin: 0;
6591 padding: 0;
6592 }
6593 </style>
6594 <script src="https://code.jquery.com/jquery-3.3.1.js"></script>
6595</head>
6596<body>
6597
6598<div class="out overout">
6599 <p>move your mouse</p>
6600 <div class="in overout"><p>move your mouse</p><p>0</p></div>
6601 <p>0</p>
6602</div>
6603
6604<div class="out enterleave">
6605 <p>move your mouse</p>
6606 <div class="in enterleave"><p>move your mouse</p><p>0</p></div>
6607 <p>0</p>
6608</div>
6609
6610<script>
6611var i = 0;
6612$( "div.overout" )
6613 .mouseover(function() {
6614 $( "p:first", this ).text( "mouse over" );
6615 $( "p:last", this ).text( ++i );
6616 })
6617 .mouseout(function() {
6618 $( "p:first", this ).text( "mouse out" );
6619 });
6620
6621var n = 0;
6622$( "div.enterleave" )
6623 .mouseenter(function() {
6624 $( "p:first", this ).text( "mouse enter" );
6625 $( "p:last", this ).text( ++n );
6626 })
6627 .mouseleave(function() {
6628 $( "p:first", this ).text( "mouse leave" );
6629 });
6630</script>
6631
6632</body>
6633</html>
6634```
6635 */
6636 mouseenter(handler?: JQuery.TypeEventHandler<TElement, null, TElement, TElement, 'mouseenter'> |
6637 false): this;
6638 /**
6639 * Bind an event handler to be fired when the mouse leaves an element, or trigger that handler on an element.
6640 * @param eventData An object containing data that will be passed to the event handler.
6641 * @param handler A function to execute each time the event is triggered.
6642 * @see \`{@link https://api.jquery.com/mouseleave/ }\`
6643 * @since 1.4.3
6644 * @deprecated ​ Deprecated since 3.3. Use \`{@link on }\` or \`{@link trigger }\`.
6645 *
6646 * **Cause**: The `.on()` and `.trigger()` methods can set an event handler or generate an event for any event type, and should be used instead of the shortcut methods. This message also applies to the other event shorthands, including: blur, focus, focusin, focusout, resize, scroll, dblclick, mousedown, mouseup, mousemove, mouseover, mouseout, mouseenter, mouseleave, change, select, submit, keydown, keypress, keyup, and contextmenu.
6647 *
6648 * **Solution**: Instead of `.click(fn)` use `.on("click", fn)`. Instead of `.click()` use `.trigger("click")`.
6649 */
6650 mouseleave<TData>(eventData: TData,
6651 handler: JQuery.TypeEventHandler<TElement, TData, TElement, TElement, 'mouseleave'>): this;
6652 /**
6653 * Bind an event handler to be fired when the mouse leaves an element, or trigger that handler on an element.
6654 * @param handler A function to execute each time the event is triggered.
6655 * @see \`{@link https://api.jquery.com/mouseleave/ }\`
6656 * @since 1.0
6657 * @deprecated ​ Deprecated since 3.3. Use \`{@link on }\` or \`{@link trigger }\`.
6658 *
6659 * **Cause**: The `.on()` and `.trigger()` methods can set an event handler or generate an event for any event type, and should be used instead of the shortcut methods. This message also applies to the other event shorthands, including: blur, focus, focusin, focusout, resize, scroll, dblclick, mousedown, mouseup, mousemove, mouseover, mouseout, mouseenter, mouseleave, change, select, submit, keydown, keypress, keyup, and contextmenu.
6660 *
6661 * **Solution**: Instead of `.click(fn)` use `.on("click", fn)`. Instead of `.click()` use `.trigger("click")`.
6662 * @example ​ ````Show number of times mouseout and mouseleave events are triggered. mouseout fires when the pointer moves out of child element as well, while mouseleave fires only when the pointer moves out of the bound element.
6663```html
6664<!doctype html>
6665<html lang="en">
6666<head>
6667 <meta charset="utf-8">
6668 <title>mouseleave demo</title>
6669 <style>
6670 div.out {
6671 width: 40%;
6672 height: 120px;
6673 margin: 0 15px;
6674 background-color: #d6edfc;
6675 float: left;
6676 }
6677 div.in {
6678 width: 60%;
6679 height: 60%;
6680 background-color: #fc0;
6681 margin: 10px auto;
6682 }
6683 p {
6684 line-height: 1em;
6685 margin: 0;
6686 padding: 0;
6687 }
6688 </style>
6689 <script src="https://code.jquery.com/jquery-3.3.1.js"></script>
6690</head>
6691<body>
6692
6693<div class="out overout">
6694 <p>move your mouse</p>
6695 <div class="in overout"><p>move your mouse</p><p>0</p></div>
6696 <p>0</p>
6697</div>
6698<div class="out enterleave">
6699 <p>move your mouse</p>
6700 <div class="in enterleave"><p>move your mouse</p><p>0</p></div>
6701 <p>0</p>
6702</div>
6703
6704<script>
6705var i = 0;
6706$( "div.overout" )
6707 .mouseover(function() {
6708 $( "p:first", this ).text( "mouse over" );
6709 })
6710 .mouseout(function() {
6711 $( "p:first", this ).text( "mouse out" );
6712 $( "p:last", this ).text( ++i );
6713 });
6714
6715var n = 0;
6716$( "div.enterleave" )
6717 .mouseenter(function() {
6718 $( "p:first", this ).text( "mouse enter" );
6719 })
6720 .mouseleave(function() {
6721 $( "p:first", this ).text( "mouse leave" );
6722 $( "p:last", this ).text( ++n );
6723 });
6724</script>
6725
6726</body>
6727</html>
6728```
6729 */
6730 mouseleave(handler?: JQuery.TypeEventHandler<TElement, null, TElement, TElement, 'mouseleave'> |
6731 false): this;
6732 /**
6733 * Bind an event handler to the "mousemove" JavaScript event, or trigger that event on an element.
6734 * @param eventData An object containing data that will be passed to the event handler.
6735 * @param handler A function to execute each time the event is triggered.
6736 * @see \`{@link https://api.jquery.com/mousemove/ }\`
6737 * @since 1.4.3
6738 * @deprecated ​ Deprecated since 3.3. Use \`{@link on }\` or \`{@link trigger }\`.
6739 *
6740 * **Cause**: The `.on()` and `.trigger()` methods can set an event handler or generate an event for any event type, and should be used instead of the shortcut methods. This message also applies to the other event shorthands, including: blur, focus, focusin, focusout, resize, scroll, dblclick, mousedown, mouseup, mousemove, mouseover, mouseout, mouseenter, mouseleave, change, select, submit, keydown, keypress, keyup, and contextmenu.
6741 *
6742 * **Solution**: Instead of `.click(fn)` use `.on("click", fn)`. Instead of `.click()` use `.trigger("click")`.
6743 */
6744 mousemove<TData>(eventData: TData,
6745 handler: JQuery.TypeEventHandler<TElement, TData, TElement, TElement, 'mousemove'>): this;
6746 /**
6747 * Bind an event handler to the "mousemove" JavaScript event, or trigger that event on an element.
6748 * @param handler A function to execute each time the event is triggered.
6749 * @see \`{@link https://api.jquery.com/mousemove/ }\`
6750 * @since 1.0
6751 * @deprecated ​ Deprecated since 3.3. Use \`{@link on }\` or \`{@link trigger }\`.
6752 *
6753 * **Cause**: The `.on()` and `.trigger()` methods can set an event handler or generate an event for any event type, and should be used instead of the shortcut methods. This message also applies to the other event shorthands, including: blur, focus, focusin, focusout, resize, scroll, dblclick, mousedown, mouseup, mousemove, mouseover, mouseout, mouseenter, mouseleave, change, select, submit, keydown, keypress, keyup, and contextmenu.
6754 *
6755 * **Solution**: Instead of `.click(fn)` use `.on("click", fn)`. Instead of `.click()` use `.trigger("click")`.
6756 * @example ​ ````Show the mouse coordinates when the mouse is moved over the yellow div. Coordinates are relative to the window, which in this case is the iframe.
6757```html
6758<!doctype html>
6759<html lang="en">
6760<head>
6761 <meta charset="utf-8">
6762 <title>mousemove demo</title>
6763 <style>
6764 div {
6765 width: 220px;
6766 height: 170px;
6767 margin: 10px 50px 10px 10px;
6768 background: yellow;
6769 border: 2px groove;
6770 float: right;
6771 }
6772 p {
6773 margin: 0;
6774 margin-left: 10px;
6775 color: red;
6776 width: 220px;
6777 height: 120px;
6778 padding-top: 70px;
6779 float: left;
6780 font-size: 14px;
6781 }
6782 span {
6783 display: block;
6784 }
6785 </style>
6786 <script src="https://code.jquery.com/jquery-3.3.1.js"></script>
6787</head>
6788<body>
6789
6790<p>
6791 <span>Move the mouse over the div.</span>
6792 <span>&nbsp;</span>
6793</p>
6794<div></div>
6795
6796<script>
6797$( "div" ).mousemove(function( event ) {
6798 var pageCoords = "( " + event.pageX + ", " + event.pageY + " )";
6799 var clientCoords = "( " + event.clientX + ", " + event.clientY + " )";
6800 $( "span:first" ).text( "( event.pageX, event.pageY ) : " + pageCoords );
6801 $( "span:last" ).text( "( event.clientX, event.clientY ) : " + clientCoords );
6802});
6803</script>
6804
6805</body>
6806</html>
6807```
6808 */
6809 mousemove(handler?: JQuery.TypeEventHandler<TElement, null, TElement, TElement, 'mousemove'> |
6810 false): this;
6811 /**
6812 * Bind an event handler to the "mouseout" JavaScript event, or trigger that event on an element.
6813 * @param eventData An object containing data that will be passed to the event handler.
6814 * @param handler A function to execute each time the event is triggered.
6815 * @see \`{@link https://api.jquery.com/mouseout/ }\`
6816 * @since 1.4.3
6817 * @deprecated ​ Deprecated since 3.3. Use \`{@link on }\` or \`{@link trigger }\`.
6818 *
6819 * **Cause**: The `.on()` and `.trigger()` methods can set an event handler or generate an event for any event type, and should be used instead of the shortcut methods. This message also applies to the other event shorthands, including: blur, focus, focusin, focusout, resize, scroll, dblclick, mousedown, mouseup, mousemove, mouseover, mouseout, mouseenter, mouseleave, change, select, submit, keydown, keypress, keyup, and contextmenu.
6820 *
6821 * **Solution**: Instead of `.click(fn)` use `.on("click", fn)`. Instead of `.click()` use `.trigger("click")`.
6822 */
6823 mouseout<TData>(eventData: TData,
6824 handler: JQuery.TypeEventHandler<TElement, TData, TElement, TElement, 'mouseout'>): this;
6825 /**
6826 * Bind an event handler to the "mouseout" JavaScript event, or trigger that event on an element.
6827 * @param handler A function to execute each time the event is triggered.
6828 * @see \`{@link https://api.jquery.com/mouseout/ }\`
6829 * @since 1.0
6830 * @deprecated ​ Deprecated since 3.3. Use \`{@link on }\` or \`{@link trigger }\`.
6831 *
6832 * **Cause**: The `.on()` and `.trigger()` methods can set an event handler or generate an event for any event type, and should be used instead of the shortcut methods. This message also applies to the other event shorthands, including: blur, focus, focusin, focusout, resize, scroll, dblclick, mousedown, mouseup, mousemove, mouseover, mouseout, mouseenter, mouseleave, change, select, submit, keydown, keypress, keyup, and contextmenu.
6833 *
6834 * **Solution**: Instead of `.click(fn)` use `.on("click", fn)`. Instead of `.click()` use `.trigger("click")`.
6835 * @example ​ ````Show the number of times mouseout and mouseleave events are triggered.
6836 mouseout fires when the pointer moves out of the child element as well, while mouseleave fires only when the pointer moves out of the bound element.
6837```html
6838<!doctype html>
6839<html lang="en">
6840<head>
6841 <meta charset="utf-8">
6842 <title>mouseout demo</title>
6843 <style>
6844 div.out {
6845 width: 40%;
6846 height: 120px;
6847 margin: 0 15px;
6848 background-color: #d6edfc;
6849 float: left;
6850 }
6851 div.in {
6852 width: 60%;
6853 height: 60%;
6854 background-color: #fc0;
6855 margin: 10px auto;
6856 }
6857 p {
6858 line-height: 1em;
6859 margin: 0;
6860 padding: 0;
6861 }
6862 </style>
6863 <script src="https://code.jquery.com/jquery-3.3.1.js"></script>
6864</head>
6865<body>
6866
6867<div class="out overout">
6868 <p>move your mouse</p>
6869 <div class="in overout"><p>move your mouse</p><p>0</p></div>
6870 <p>0</p>
6871</div>
6872
6873<div class="out enterleave">
6874 <p>move your mouse</p>
6875 <div class="in enterleave"><p>move your mouse</p><p>0</p></div>
6876 <p>0</p>
6877</div>
6878
6879<script>
6880var i = 0;
6881$( "div.overout" )
6882 .mouseout(function() {
6883 $( "p:first", this ).text( "mouse out" );
6884 $( "p:last", this ).text( ++i );
6885 })
6886 .mouseover(function() {
6887 $( "p:first", this ).text( "mouse over" );
6888 });
6889
6890var n = 0;
6891$( "div.enterleave" )
6892 .on( "mouseenter", function() {
6893 $( "p:first", this ).text( "mouse enter" );
6894 })
6895 .on( "mouseleave", function() {
6896 $( "p:first", this ).text( "mouse leave" );
6897 $( "p:last", this ).text( ++n );
6898 });
6899</script>
6900
6901</body>
6902</html>
6903```
6904 */
6905 mouseout(handler?: JQuery.TypeEventHandler<TElement, null, TElement, TElement, 'mouseout'> |
6906 false): this;
6907 /**
6908 * Bind an event handler to the "mouseover" JavaScript event, or trigger that event on an element.
6909 * @param eventData An object containing data that will be passed to the event handler.
6910 * @param handler A function to execute each time the event is triggered.
6911 * @see \`{@link https://api.jquery.com/mouseover/ }\`
6912 * @since 1.4.3
6913 * @deprecated ​ Deprecated since 3.3. Use \`{@link on }\` or \`{@link trigger }\`.
6914 *
6915 * **Cause**: The `.on()` and `.trigger()` methods can set an event handler or generate an event for any event type, and should be used instead of the shortcut methods. This message also applies to the other event shorthands, including: blur, focus, focusin, focusout, resize, scroll, dblclick, mousedown, mouseup, mousemove, mouseover, mouseout, mouseenter, mouseleave, change, select, submit, keydown, keypress, keyup, and contextmenu.
6916 *
6917 * **Solution**: Instead of `.click(fn)` use `.on("click", fn)`. Instead of `.click()` use `.trigger("click")`.
6918 */
6919 mouseover<TData>(eventData: TData,
6920 handler: JQuery.TypeEventHandler<TElement, TData, TElement, TElement, 'mouseover'>): this;
6921 /**
6922 * Bind an event handler to the "mouseover" JavaScript event, or trigger that event on an element.
6923 * @param handler A function to execute each time the event is triggered.
6924 * @see \`{@link https://api.jquery.com/mouseover/ }\`
6925 * @since 1.0
6926 * @deprecated ​ Deprecated since 3.3. Use \`{@link on }\` or \`{@link trigger }\`.
6927 *
6928 * **Cause**: The `.on()` and `.trigger()` methods can set an event handler or generate an event for any event type, and should be used instead of the shortcut methods. This message also applies to the other event shorthands, including: blur, focus, focusin, focusout, resize, scroll, dblclick, mousedown, mouseup, mousemove, mouseover, mouseout, mouseenter, mouseleave, change, select, submit, keydown, keypress, keyup, and contextmenu.
6929 *
6930 * **Solution**: Instead of `.click(fn)` use `.on("click", fn)`. Instead of `.click()` use `.trigger("click")`.
6931 * @example ​ ````Show the number of times mouseover and mouseenter events are triggered.
6932mouseover fires when the pointer moves into the child element as well, while mouseenter fires only when the pointer moves into the bound element.
6933```html
6934<!doctype html>
6935<html lang="en">
6936<head>
6937 <meta charset="utf-8">
6938 <title>mouseover demo</title>
6939 <style>
6940 div.out {
6941 width: 40%;
6942 height: 120px;
6943 margin: 0 15px;
6944 background-color: #d6edfc;
6945 float: left;
6946 }
6947 div.in {
6948 width: 60%;
6949 height: 60%;
6950 background-color: #fc0;
6951 margin: 10px auto;
6952 }
6953 p {
6954 line-height: 1em;
6955 margin: 0;
6956 padding: 0;
6957 }
6958 </style>
6959 <script src="https://code.jquery.com/jquery-3.3.1.js"></script>
6960</head>
6961<body>
6962
6963<div class="out overout">
6964 <span>move your mouse</span>
6965 <div class="in">
6966 </div>
6967</div>
6968
6969<div class="out enterleave">
6970 <span>move your mouse</span>
6971 <div class="in">
6972 </div>
6973</div>
6974
6975<script>
6976var i = 0;
6977$( "div.overout" )
6978 .mouseover(function() {
6979 i += 1;
6980 $( this ).find( "span" ).text( "mouse over x " + i );
6981 })
6982 .mouseout(function() {
6983 $( this ).find( "span" ).text( "mouse out " );
6984 });
6985
6986var n = 0;
6987$( "div.enterleave" )
6988 .mouseenter(function() {
6989 n += 1;
6990 $( this ).find( "span" ).text( "mouse enter x " + n );
6991 })
6992 .mouseleave(function() {
6993 $( this ).find( "span" ).text( "mouse leave" );
6994 });
6995</script>
6996
6997</body>
6998</html>
6999```
7000 */
7001 mouseover(handler?: JQuery.TypeEventHandler<TElement, null, TElement, TElement, 'mouseover'> |
7002 false): this;
7003 /**
7004 * Bind an event handler to the "mouseup" JavaScript event, or trigger that event on an element.
7005 * @param eventData An object containing data that will be passed to the event handler.
7006 * @param handler A function to execute each time the event is triggered.
7007 * @see \`{@link https://api.jquery.com/mouseup/ }\`
7008 * @since 1.4.3
7009 * @deprecated ​ Deprecated since 3.3. Use \`{@link on }\` or \`{@link trigger }\`.
7010 *
7011 * **Cause**: The `.on()` and `.trigger()` methods can set an event handler or generate an event for any event type, and should be used instead of the shortcut methods. This message also applies to the other event shorthands, including: blur, focus, focusin, focusout, resize, scroll, dblclick, mousedown, mouseup, mousemove, mouseover, mouseout, mouseenter, mouseleave, change, select, submit, keydown, keypress, keyup, and contextmenu.
7012 *
7013 * **Solution**: Instead of `.click(fn)` use `.on("click", fn)`. Instead of `.click()` use `.trigger("click")`.
7014 */
7015 mouseup<TData>(eventData: TData,
7016 handler: JQuery.TypeEventHandler<TElement, TData, TElement, TElement, 'mouseup'>): this;
7017 /**
7018 * Bind an event handler to the "mouseup" JavaScript event, or trigger that event on an element.
7019 * @param handler A function to execute each time the event is triggered.
7020 * @see \`{@link https://api.jquery.com/mouseup/ }\`
7021 * @since 1.0
7022 * @deprecated ​ Deprecated since 3.3. Use \`{@link on }\` or \`{@link trigger }\`.
7023 *
7024 * **Cause**: The `.on()` and `.trigger()` methods can set an event handler or generate an event for any event type, and should be used instead of the shortcut methods. This message also applies to the other event shorthands, including: blur, focus, focusin, focusout, resize, scroll, dblclick, mousedown, mouseup, mousemove, mouseover, mouseout, mouseenter, mouseleave, change, select, submit, keydown, keypress, keyup, and contextmenu.
7025 *
7026 * **Solution**: Instead of `.click(fn)` use `.on("click", fn)`. Instead of `.click()` use `.trigger("click")`.
7027 * @example ​ ````Show texts when mouseup and mousedown event triggering.
7028```html
7029<!doctype html>
7030<html lang="en">
7031<head>
7032 <meta charset="utf-8">
7033 <title>mouseup demo</title>
7034 <script src="https://code.jquery.com/jquery-3.3.1.js"></script>
7035</head>
7036<body>
7037
7038<p>Press mouse and release here.</p>
7039
7040<script>
7041$( "p" )
7042 .mouseup(function() {
7043 $( this ).append( "<span style='color:#f00;'>Mouse up.</span>" );
7044 })
7045 .mousedown(function() {
7046 $( this ).append( "<span style='color:#00f;'>Mouse down.</span>" );
7047 });
7048</script>
7049
7050</body>
7051</html>
7052```
7053 */
7054 mouseup(handler?: JQuery.TypeEventHandler<TElement, null, TElement, TElement, 'mouseup'> |
7055 false): this;
7056 /**
7057 * Get the immediately following sibling of each element in the set of matched elements. If a selector is provided, it retrieves the next sibling only if it matches that selector.
7058 * @param selector A string containing a selector expression to match elements against.
7059 * @see \`{@link https://api.jquery.com/next/ }\`
7060 * @since 1.0
7061 * @example ​ ````Find the very next sibling of each disabled button and change its text &quot;this button is disabled&quot;.
7062```html
7063<!doctype html>
7064<html lang="en">
7065<head>
7066 <meta charset="utf-8">
7067 <title>next demo</title>
7068 <style>
7069 span {
7070 color: blue;
7071 font-weight: bold;
7072 }
7073 button {
7074 width: 100px;
7075 }
7076 </style>
7077 <script src="https://code.jquery.com/jquery-3.3.1.js"></script>
7078</head>
7079<body>
7080
7081<div><button disabled="disabled">First</button> - <span></span></div>
7082<div><button>Second</button> - <span></span></div>
7083<div><button disabled="disabled">Third</button> - <span></span></div>
7084
7085<script>
7086$( "button[disabled]" ).next().text( "this button is disabled" );
7087</script>
7088
7089</body>
7090</html>
7091```
7092 * @example ​ ````Find the very next sibling of each paragraph. Keep only the ones with a class &quot;selected&quot;.
7093```html
7094<!doctype html>
7095<html lang="en">
7096<head>
7097 <meta charset="utf-8">
7098 <title>next demo</title>
7099 <script src="https://code.jquery.com/jquery-3.3.1.js"></script>
7100</head>
7101<body>
7102
7103<p>Hello</p>
7104<p class="selected">Hello Again</p>
7105<div><span>And Again</span></div>
7106
7107<script>
7108$( "p" ).next( ".selected" ).css( "background", "yellow" );
7109</script>
7110
7111</body>
7112</html>
7113```
7114 */
7115 next(selector?: JQuery.Selector): this;
7116 /**
7117 * Get all following siblings of each element in the set of matched elements, optionally filtered by a selector.
7118 * @param selector A string containing a selector expression to match elements against.
7119 * @see \`{@link https://api.jquery.com/nextAll/ }\`
7120 * @since 1.2
7121 * @example ​ ````Locate all the divs after the first and give them a class.
7122```html
7123<!doctype html>
7124<html lang="en">
7125<head>
7126 <meta charset="utf-8">
7127 <title>nextAll demo</title>
7128 <style>
7129 div {
7130 width: 80px;
7131 height: 80px;
7132 background: #abc;
7133 border: 2px solid black;
7134 margin: 10px;
7135 float: left;
7136 }
7137 div.after {
7138 border-color: red;
7139 }
7140 </style>
7141 <script src="https://code.jquery.com/jquery-3.3.1.js"></script>
7142</head>
7143<body>
7144
7145<div>first</div>
7146<div>sibling<div>child</div></div>
7147<div>sibling</div>
7148<div>sibling</div>​
7149<script>
7150$( "div:first" ).nextAll().addClass( "after" );
7151</script>
7152
7153</body>
7154</html>
7155```
7156 * @example ​ ````Locate all the paragraphs after the second child in the body and give them a class.
7157```html
7158<!doctype html>
7159<html lang="en">
7160<head>
7161 <meta charset="utf-8">
7162 <title>nextAll demo</title>
7163 <style>
7164 div, p {
7165 width: 60px;
7166 height: 60px;
7167 background: #abc;
7168 border: 2px solid black;
7169 margin: 10px;
7170 float: left;
7171 }
7172 .after {
7173 border-color: red;
7174 }
7175 </style>
7176 <script src="https://code.jquery.com/jquery-3.3.1.js"></script>
7177</head>
7178<body>
7179
7180<p>p</p>
7181<div>div</div>
7182<p>p</p>
7183<p>p</p>
7184<div>div</div>
7185<p>p</p>
7186<div>div</div>
7187
7188<script>
7189$( ":nth-child(1)" ).nextAll( "p" ).addClass( "after" );
7190</script>
7191
7192</body>
7193</html>
7194```
7195 */
7196 nextAll(selector?: string): this;
7197 /**
7198 * Get all following siblings of each element up to but not including the element matched by the selector, DOM node, or jQuery object passed.
7199 * @param selector_element _&#x40;param_ `selector_element`
7200 * <br>
7201 * * `selector` — A string containing a selector expression to indicate where to stop matching following sibling elements. <br>
7202 * * `element` — A DOM node or jQuery object indicating where to stop matching following sibling elements.
7203 * @param filter A string containing a selector expression to match elements against.
7204 * @see \`{@link https://api.jquery.com/nextUntil/ }\`
7205 * @since 1.4
7206 * @since 1.6
7207 * @example ​ ````Find the siblings that follow &lt;dt id=&quot;term-2&quot;&gt; up to the next &lt;dt&gt; and give them a red background color. Also, find &lt;dd&gt; siblings that follow &lt;dt id=&quot;term-1&quot;&gt; up to &lt;dt id=&quot;term-3&quot;&gt; and give them a green text color.
7208```html
7209<!doctype html>
7210<html lang="en">
7211<head>
7212 <meta charset="utf-8">
7213 <title>nextUntil demo</title>
7214 <script src="https://code.jquery.com/jquery-3.3.1.js"></script>
7215</head>
7216<body>
7217
7218<dl>
7219 <dt id="term-1">term 1</dt>
7220 <dd>definition 1-a</dd>
7221 <dd>definition 1-b</dd>
7222 <dd>definition 1-c</dd>
7223 <dd>definition 1-d</dd>
7224 <dt id="term-2">term 2</dt>
7225 <dd>definition 2-a</dd>
7226 <dd>definition 2-b</dd>
7227 <dd>definition 2-c</dd>
7228 <dt id="term-3">term 3</dt>
7229 <dd>definition 3-a</dd>
7230 <dd>definition 3-b</dd>
7231</dl>
7232
7233<script>
7234$( "#term-2" )
7235 .nextUntil( "dt" )
7236 .css( "background-color", "red" );
7237var term3 = document.getElementById( "term-3" );
7238$( "#term-1" )
7239 .nextUntil( term3, "dd" )
7240 .css( "color", "green" );
7241</script>
7242
7243</body>
7244</html>
7245```
7246 */
7247 nextUntil(selector_element?: JQuery.Selector | Element | JQuery, filter?: JQuery.Selector): this;
7248 /**
7249 * Remove elements from the set of matched elements.
7250 * @param selector_function_selection _&#x40;param_ `selector_function_selection`
7251 * <br>
7252 * * `selector` — A string containing a selector expression, a DOM element, or an array of elements to match against the set. <br>
7253 * * `function` — A function used as a test for each element in the set. It accepts two arguments, `index`, which is
7254 * the element's index in the jQuery collection, and `element`, which is the DOM element. Within the
7255 * function, `this` refers to the current DOM element. <br>
7256 * * `selection` — An existing jQuery object to match the current set of elements against.
7257 * @see \`{@link https://api.jquery.com/not/ }\`
7258 * @since 1.0
7259 * @since 1.4
7260 * @example ​ ````Adds a border to divs that are not green or blue.
7261```html
7262<!doctype html>
7263<html lang="en">
7264<head>
7265 <meta charset="utf-8">
7266 <title>not demo</title>
7267 <style>
7268 div {
7269 width: 50px;
7270 height: 50px;
7271 margin: 10px;
7272 float: left;
7273 background: yellow;
7274 border: 2px solid white;
7275 }
7276 .green {
7277 background: #8f8;
7278 }
7279 .gray {
7280 background: #ccc;
7281 }
7282 #blueone {
7283 background: #99f;
7284 }
7285 </style>
7286 <script src="https://code.jquery.com/jquery-3.3.1.js"></script>
7287</head>
7288<body>
7289
7290<div></div>
7291<div id="blueone"></div>
7292<div></div>
7293<div class="green"></div>
7294<div class="green"></div>
7295<div class="gray"></div>
7296<div></div>
7297
7298<script>
7299$( "div" ).not( ".green, #blueone" )
7300 .css( "border-color", "red" );
7301</script>
7302
7303</body>
7304</html>
7305```
7306 * @example ​ ````Removes the element with the ID &quot;selected&quot; from the set of all paragraphs.
7307```javascript
7308$( "p" ).not( $( "#selected" )[ 0 ] );
7309```
7310 * @example ​ ````Removes the element with the ID &quot;selected&quot; from the set of all paragraphs.
7311```javascript
7312$( "p" ).not( "#selected" );
7313```
7314 * @example ​ ````Removes all elements that match &quot;div p.selected&quot; from the total set of all paragraphs.
7315```javascript
7316$( "p" ).not( $( "div p.selected" ) );
7317```
7318 */
7319 not(selector_function_selection: JQuery.Selector | JQuery.TypeOrArray<Element> | JQuery | ((this: TElement, index: number, element: TElement) => boolean)): this;
7320 /**
7321 * Remove an event handler.
7322 * @param events One or more space-separated event types and optional namespaces, or just namespaces, such as
7323 * "click", "keydown.myPlugin", or ".myPlugin".
7324 * @param selector A selector which should match the one originally passed to .on() when attaching event handlers.
7325 * @param handler A function to execute each time the event is triggered.
7326 * @see \`{@link https://api.jquery.com/off/ }\`
7327 * @since 1.7
7328 * @example ​ ````Add and remove event handlers on the colored button.
7329```html
7330<!doctype html>
7331<html lang="en">
7332<head>
7333 <meta charset="utf-8">
7334 <title>off demo</title>
7335 <style>
7336 button {
7337 margin: 5px;
7338 }
7339 button#theone {
7340 color: red;
7341 background: yellow;
7342 }
7343 </style>
7344 <script src="https://code.jquery.com/jquery-3.3.1.js"></script>
7345</head>
7346<body>
7347
7348<button id="theone">Does nothing...</button>
7349<button id="bind">Add Click</button>
7350<button id="unbind">Remove Click</button>
7351<div style="display:none;">Click!</div>
7352
7353<script>
7354function flash() {
7355 $( "div" ).show().fadeOut( "slow" );
7356}
7357$( "#bind" ).click(function() {
7358 $( "body" )
7359 .on( "click", "#theone", flash )
7360 .find( "#theone" )
7361 .text( "Can Click!" );
7362});
7363$( "#unbind" ).click(function() {
7364 $( "body" )
7365 .off( "click", "#theone", flash )
7366 .find( "#theone" )
7367 .text( "Does nothing..." );
7368});
7369</script>
7370
7371</body>
7372</html>
7373```
7374 * @example ​ ````Remove just one previously bound handler by passing it as the third argument:
7375```javascript
7376var foo = function() {
7377 // Code to handle some kind of event
7378};
7379
7380// ... Now foo will be called when paragraphs are clicked ...
7381$( "body" ).on( "click", "p", foo );
7382
7383// ... Foo will no longer be called.
7384$( "body" ).off( "click", "p", foo );
7385```
7386 */
7387 off<TType extends string>(
7388 events: TType,
7389 selector: JQuery.Selector,
7390 handler: JQuery.TypeEventHandler<TElement, any, any, any, TType> |
7391 false
7392 ): this;
7393 /**
7394 * Remove an event handler.
7395 * @param events One or more space-separated event types and optional namespaces, or just namespaces, such as
7396 * "click", "keydown.myPlugin", or ".myPlugin".
7397 * @param selector_handler _&#x40;param_ `selector_handler`
7398 * <br>
7399 * * `selector` — A selector which should match the one originally passed to `.on()` when attaching event handlers. <br>
7400 * * `handler` — A handler function previously attached for the event(s), or the special value `false`.
7401 * @see \`{@link https://api.jquery.com/off/ }\`
7402 * @since 1.7
7403 * @example ​ ````Remove all delegated click handlers from all paragraphs:
7404```javascript
7405$( "p" ).off( "click", "**" );
7406```
7407 * @example ​ ````Unbind all delegated event handlers by their namespace:
7408```javascript
7409var validate = function() {
7410 // Code to validate form entries
7411};
7412
7413// Delegate events under the ".validator" namespace
7414$( "form" ).on( "click.validator", "button", validate );
7415
7416$( "form" ).on( "keypress.validator", "input[type='text']", validate );
7417
7418// Remove event handlers in the ".validator" namespace
7419$( "form" ).off( ".validator" );
7420```
7421 */
7422 off<TType extends string>(
7423 events: TType,
7424 selector_handler?: JQuery.Selector |
7425 JQuery.TypeEventHandler<TElement, any, any, any, TType> |
7426 false
7427 ): this;
7428 /**
7429 * Remove an event handler.
7430 * @param events An object where the string keys represent one or more space-separated event types and optional
7431 * namespaces, and the values represent handler functions previously attached for the event(s).
7432 * @param selector A selector which should match the one originally passed to .on() when attaching event handlers.
7433 * @see \`{@link https://api.jquery.com/off/ }\`
7434 * @since 1.7
7435 */
7436 off(events: JQuery.TypeEventHandlers<TElement, any, any, any>,
7437 selector?: JQuery.Selector): this;
7438 /**
7439 * Remove an event handler.
7440 * @param event A jQuery.Event object.
7441 * @see \`{@link https://api.jquery.com/off/ }\`
7442 * @since 1.7
7443 * @example ​ ````Remove all event handlers from all paragraphs:
7444```javascript
7445$( "p" ).off();
7446```
7447 */
7448 off(event?: JQuery.TriggeredEvent<TElement>): this;
7449 /**
7450 * Set the current coordinates of every element in the set of matched elements, relative to the document.
7451 * @param coordinates_function _&#x40;param_ `coordinates_function`
7452 * <br>
7453 * * `coordinates` — An object containing the properties `top` and `left`, which are numbers indicating the new top and
7454 * left coordinates for the elements. <br>
7455 * * `function` — A function to return the coordinates to set. Receives the index of the element in the collection as
7456 * the first argument and the current coordinates as the second argument. The function should return an
7457 * object with the new `top` and `left` properties.
7458 * @see \`{@link https://api.jquery.com/offset/ }\`
7459 * @since 1.4
7460 * @example ​ ````Set the offset of the second paragraph:
7461```html
7462<!doctype html>
7463<html lang="en">
7464<head>
7465 <meta charset="utf-8">
7466 <title>offset demo</title>
7467 <style>
7468 p {
7469 margin-left: 10px;
7470 }
7471 </style>
7472 <script src="https://code.jquery.com/jquery-3.3.1.js"></script>
7473</head>
7474<body>
7475
7476<p>Hello</p><p>2nd Paragraph</p>
7477
7478<script>
7479$( "p:last" ).offset({ top: 10, left: 30 });
7480</script>
7481
7482</body>
7483</html>
7484```
7485 */
7486 offset(coordinates_function: JQuery.CoordinatesPartial | ((this: TElement, index: number, coords: JQuery.Coordinates) => JQuery.CoordinatesPartial)): this;
7487 /**
7488 * Get the current coordinates of the first element in the set of matched elements, relative to the document.
7489 * @see \`{@link https://api.jquery.com/offset/ }\`
7490 * @since 1.2
7491 * @example ​ ````Access the offset of the second paragraph:
7492```html
7493<!doctype html>
7494<html lang="en">
7495<head>
7496 <meta charset="utf-8">
7497 <title>offset demo</title>
7498 <style>
7499 p {
7500 margin-left: 10px;
7501 }
7502 </style>
7503 <script src="https://code.jquery.com/jquery-3.3.1.js"></script>
7504</head>
7505<body>
7506
7507<p>Hello</p><p>2nd Paragraph</p>
7508
7509<script>
7510var p = $( "p:last" );
7511var offset = p.offset();
7512p.html( "left: " + offset.left + ", top: " + offset.top );
7513</script>
7514
7515</body>
7516</html>
7517```
7518 * @example ​ ````Click to see the offset.
7519```html
7520<!doctype html>
7521<html lang="en">
7522<head>
7523 <meta charset="utf-8">
7524 <title>offset demo</title>
7525 <style>
7526 p {
7527 margin-left: 10px;
7528 color: blue;
7529 width: 200px;
7530 cursor: pointer;
7531 }
7532 span {
7533 color: red;
7534 cursor: pointer;
7535 }
7536 div.abs {
7537 width: 50px;
7538 height: 50px;
7539 position: absolute;
7540 left: 220px;
7541 top: 35px;
7542 background-color: green;
7543 cursor: pointer;
7544 }
7545 </style>
7546 <script src="https://code.jquery.com/jquery-3.3.1.js"></script>
7547</head>
7548<body>
7549
7550<div id="result">Click an element.</div>
7551<p>
7552 This is the best way to <span>find</span> an offset.
7553</p>
7554<div class="abs">
7555</div>
7556
7557<script>
7558$( "*", document.body ).click(function( event ) {
7559 var offset = $( this ).offset();
7560 event.stopPropagation();
7561 $( "#result" ).text( this.tagName +
7562 " coords ( " + offset.left + ", " + offset.top + " )" );
7563});
7564</script>
7565
7566</body>
7567</html>
7568```
7569 */
7570 offset(): JQuery.Coordinates | undefined;
7571 /**
7572 * Get the closest ancestor element that is positioned.
7573 * @see \`{@link https://api.jquery.com/offsetParent/ }\`
7574 * @since 1.2.6
7575 * @example ​ ````Find the offsetParent of item &quot;A.&quot;
7576```html
7577<!doctype html>
7578<html lang="en">
7579<head>
7580 <meta charset="utf-8">
7581 <title>offsetParent demo</title>
7582 <script src="https://code.jquery.com/jquery-3.3.1.js"></script>
7583</head>
7584<body>
7585
7586<ul class="level-1">
7587 <li class="item-i">I</li>
7588 <li class="item-ii" style="position: relative;">II
7589 <ul class="level-2">
7590 <li class="item-a">A</li>
7591 <li class="item-b">B
7592 <ul class="level-3">
7593 <li class="item-1">1</li>
7594 <li class="item-2">2</li>
7595 <li class="item-3">3</li>
7596 </ul>
7597 </li>
7598 <li class="item-c">C</li>
7599 </ul>
7600 </li>
7601 <li class="item-iii">III</li>
7602</ul>
7603
7604<script>$( "li.item-a" ).offsetParent().css( "background-color", "red" );</script>
7605
7606</body>
7607</html>
7608```
7609 */
7610 offsetParent(): this;
7611 /**
7612 * Attach an event handler function for one or more events to the selected elements.
7613 * @param events One or more space-separated event types and optional namespaces, such as "click" or "keydown.myPlugin".
7614 * @param selector A selector string to filter the descendants of the selected elements that trigger the event. If the
7615 * selector is null or omitted, the event is always triggered when it reaches the selected element.
7616 * @param data Data to be passed to the handler in event.data when an event is triggered.
7617 * @param handler A function to execute when the event is triggered.
7618 * @see \`{@link https://api.jquery.com/on/ }\`
7619 * @since 1.7
7620 */
7621 on<TType extends string,
7622 TData>(
7623 events: TType,
7624 selector: JQuery.Selector,
7625 data: TData,
7626 handler: JQuery.TypeEventHandler<TElement, TData, any, any, TType>
7627 ): this;
7628 /**
7629 * Attach an event handler function for one or more events to the selected elements.
7630 * @param events One or more space-separated event types and optional namespaces, such as "click" or "keydown.myPlugin".
7631 * @param selector A selector string to filter the descendants of the selected elements that trigger the event. If the
7632 * selector is null or omitted, the event is always triggered when it reaches the selected element.
7633 * @param data Data to be passed to the handler in event.data when an event is triggered.
7634 * @param handler A function to execute when the event is triggered.
7635 * @see \`{@link https://api.jquery.com/on/ }\`
7636 * @since 1.7
7637 */
7638 on<TType extends string,
7639 TData>(
7640 events: TType,
7641 selector: null | undefined,
7642 data: TData,
7643 handler: JQuery.TypeEventHandler<TElement, TData, TElement, TElement, TType>
7644 ): this;
7645 /**
7646 * Attach an event handler function for one or more events to the selected elements.
7647 * @param events One or more space-separated event types and optional namespaces, such as "click" or "keydown.myPlugin".
7648 * @param selector A selector string to filter the descendants of the selected elements that trigger the event. If the
7649 * selector is null or omitted, the event is always triggered when it reaches the selected element.
7650 * @param data Data to be passed to the handler in event.data when an event is triggered.
7651 * @param handler A function to execute when the event is triggered.
7652 * @see \`{@link https://api.jquery.com/on/ }\`
7653 * @since 1.7
7654 * @deprecated ​ Deprecated. Use \`{@link JQuery.Event }\` in place of \`{@link JQueryEventObject }\`.
7655 */
7656 on(events: string,
7657 selector: JQuery.Selector | null | undefined,
7658 data: any,
7659 handler: ((event: JQueryEventObject) => void)): this;
7660 /**
7661 * Attach an event handler function for one or more events to the selected elements.
7662 * @param events One or more space-separated event types and optional namespaces, such as "click" or "keydown.myPlugin".
7663 * @param selector A selector string to filter the descendants of the selected elements that trigger the event. If the
7664 * selector is null or omitted, the event is always triggered when it reaches the selected element.
7665 * @param handler A function to execute when the event is triggered. The value false is also allowed as a shorthand
7666 * for a function that simply does return false.
7667 * @see \`{@link https://api.jquery.com/on/ }\`
7668 * @since 1.7
7669 * @example ​ ````Click any paragraph to add another after it. Note that .on() allows a click event on any paragraph--even new ones--since the event is handled by the ever-present body element after it bubbles to there.
7670```html
7671<!doctype html>
7672<html lang="en">
7673<head>
7674 <meta charset="utf-8">
7675 <title>on demo</title>
7676 <style>
7677 p {
7678 background: yellow;
7679 font-weight: bold;
7680 cursor: pointer;
7681 padding: 5px;
7682 }
7683 p.over {
7684 background: #ccc;
7685 }
7686 span {
7687 color: red;
7688 }
7689 </style>
7690 <script src="https://code.jquery.com/jquery-3.3.1.js"></script>
7691</head>
7692<body>
7693
7694<p>Click me!</p>
7695<span></span>
7696
7697<script>
7698var count = 0;
7699$( "body" ).on( "click", "p", function() {
7700 $( this ).after( "<p>Another paragraph! " + (++count) + "</p>" );
7701});
7702</script>
7703
7704</body>
7705</html>
7706```
7707 * @example ​ ````Display each paragraph&#39;s text in an alert box whenever it is clicked:
7708```javascript
7709$( "body" ).on( "click", "p", function() {
7710 alert( $( this ).text() );
7711});
7712```
7713 * @example ​ ````Cancel a link&#39;s default action using the .preventDefault() method:
7714```javascript
7715$( "body" ).on( "click", "a", function( event ) {
7716 event.preventDefault();
7717});
7718```
7719 */
7720 on<TType extends string>(
7721 events: TType,
7722 selector: JQuery.Selector,
7723 handler: JQuery.TypeEventHandler<TElement, undefined, any, any, TType> |
7724 false
7725 ): this;
7726 /**
7727 * Attach an event handler function for one or more events to the selected elements.
7728 * @param events One or more space-separated event types and optional namespaces, such as "click" or "keydown.myPlugin".
7729 * @param data Data to be passed to the handler in event.data when an event is triggered.
7730 * @param handler A function to execute when the event is triggered.
7731 * @see \`{@link https://api.jquery.com/on/ }\`
7732 * @since 1.7
7733 * @example ​ ````Pass data to the event handler, which is specified here by name:
7734```javascript
7735function myHandler( event ) {
7736 alert( event.data.foo );
7737}
7738$( "p" ).on( "click", { foo: "bar" }, myHandler );
7739```
7740 */
7741 on<TType extends string,
7742 TData>(
7743 events: TType,
7744 data: TData,
7745 handler: JQuery.TypeEventHandler<TElement, TData, TElement, TElement, TType>
7746 ): this;
7747 /**
7748 * Attach an event handler function for one or more events to the selected elements.
7749 * @param events One or more space-separated event types and optional namespaces, such as "click" or "keydown.myPlugin".
7750 * @param selector_data _&#x40;param_ `selector_data`
7751 * <br>
7752 * * `selector` — A selector string to filter the descendants of the selected elements that trigger the event. If the
7753 * selector is null or omitted, the event is always triggered when it reaches the selected element. <br>
7754 * * `data` — Data to be passed to the handler in event.data when an event is triggered.
7755 * @param handler A function to execute when the event is triggered.
7756 * @see \`{@link https://api.jquery.com/on/ }\`
7757 * @since 1.7
7758 * @deprecated ​ Deprecated. Use \`{@link JQuery.Event }\` in place of \`{@link JQueryEventObject }\`.
7759 * @example ​ ````Click any paragraph to add another after it. Note that .on() allows a click event on any paragraph--even new ones--since the event is handled by the ever-present body element after it bubbles to there.
7760```html
7761<!doctype html>
7762<html lang="en">
7763<head>
7764 <meta charset="utf-8">
7765 <title>on demo</title>
7766 <style>
7767 p {
7768 background: yellow;
7769 font-weight: bold;
7770 cursor: pointer;
7771 padding: 5px;
7772 }
7773 p.over {
7774 background: #ccc;
7775 }
7776 span {
7777 color: red;
7778 }
7779 </style>
7780 <script src="https://code.jquery.com/jquery-3.3.1.js"></script>
7781</head>
7782<body>
7783
7784<p>Click me!</p>
7785<span></span>
7786
7787<script>
7788var count = 0;
7789$( "body" ).on( "click", "p", function() {
7790 $( this ).after( "<p>Another paragraph! " + (++count) + "</p>" );
7791});
7792</script>
7793
7794</body>
7795</html>
7796```
7797 * @example ​ ````Display each paragraph&#39;s text in an alert box whenever it is clicked:
7798```javascript
7799$( "body" ).on( "click", "p", function() {
7800 alert( $( this ).text() );
7801});
7802```
7803 * @example ​ ````Cancel a link&#39;s default action using the .preventDefault() method:
7804```javascript
7805$( "body" ).on( "click", "a", function( event ) {
7806 event.preventDefault();
7807});
7808```
7809 * @example ​ ````Pass data to the event handler, which is specified here by name:
7810```javascript
7811function myHandler( event ) {
7812 alert( event.data.foo );
7813}
7814$( "p" ).on( "click", { foo: "bar" }, myHandler );
7815```
7816 */
7817 on(events: string,
7818 selector_data: any,
7819 handler: ((event: JQueryEventObject) => void)): this;
7820 /**
7821 * Attach an event handler function for one or more events to the selected elements.
7822 * @param events One or more space-separated event types and optional namespaces, such as "click" or "keydown.myPlugin".
7823 * @param handler A function to execute when the event is triggered. The value false is also allowed as a shorthand
7824 * for a function that simply does return false.
7825 * @see \`{@link https://api.jquery.com/on/ }\`
7826 * @since 1.7
7827 * @example ​ ````Display a paragraph&#39;s text in an alert when it is clicked:
7828```javascript
7829$( "p" ).on( "click", function() {
7830 alert( $( this ).text() );
7831});
7832```
7833 * @example ​ ````Cancel a form submit action and prevent the event from bubbling up by returning false:
7834```javascript
7835$( "form" ).on( "submit", false );
7836```
7837 * @example ​ ````Cancel only the default action by using .preventDefault().
7838```javascript
7839$( "form" ).on( "submit", function( event ) {
7840 event.preventDefault();
7841});
7842```
7843 * @example ​ ````Stop submit events from bubbling without preventing form submit, using .stopPropagation().
7844```javascript
7845$( "form" ).on( "submit", function( event ) {
7846 event.stopPropagation();
7847});
7848```
7849 * @example ​ ````Pass data to the event handler using the second argument to .trigger()
7850```javascript
7851$( "div" ).on( "click", function( event, person ) {
7852 alert( "Hello, " + person.name );
7853});
7854$( "div" ).trigger( "click", { name: "Jim" } );
7855```
7856 * @example ​ ````Use the the second argument of .trigger() to pass an array of data to the event handler
7857```javascript
7858$( "div" ).on( "click", function( event, salutation, name ) {
7859 alert( salutation + ", " + name );
7860});
7861$( "div" ).trigger( "click", [ "Goodbye", "Jim" ] );
7862```
7863 * @example ​ ````Attach and trigger custom (non-browser) events.
7864```html
7865<!doctype html>
7866<html lang="en">
7867<head>
7868 <meta charset="utf-8">
7869 <title>on demo</title>
7870 <style>
7871 p {
7872 color: red;
7873 }
7874 span {
7875 color: blue;
7876 }
7877 </style>
7878 <script src="https://code.jquery.com/jquery-3.3.1.js"></script>
7879</head>
7880<body>
7881
7882<p>Has an attached custom event.</p>
7883<button>Trigger custom event</button>
7884<span style="display:none;"></span>
7885
7886<script>
7887$( "p" ).on( "myCustomEvent", function( event, myName ) {
7888 $( this ).text( myName + ", hi there!" );
7889 $( "span" )
7890 .stop()
7891 .css( "opacity", 1 )
7892 .text( "myName = " + myName )
7893 .fadeIn( 30 )
7894 .fadeOut( 1000 );
7895});
7896$( "button" ).click(function () {
7897 $( "p" ).trigger( "myCustomEvent", [ "John" ] );
7898});
7899</script>
7900
7901</body>
7902</html>
7903```
7904 * @example ​ ````Attach multiple events—one on mouseenter and one on mouseleave to the same element:
7905```javascript
7906$( "#cart" ).on( "mouseenter mouseleave", function( event ) {
7907 $( this ).toggleClass( "active" );
7908});
7909```
7910 */
7911 on<TType extends string>(
7912 events: TType,
7913 handler: JQuery.TypeEventHandler<TElement, undefined, TElement, TElement, TType> |
7914 false
7915 ): this;
7916 /**
7917 * Attach an event handler function for one or more events to the selected elements.
7918 * @param events One or more space-separated event types and optional namespaces, such as "click" or "keydown.myPlugin".
7919 * @param handler A function to execute when the event is triggered.
7920 * @see \`{@link https://api.jquery.com/on/ }\`
7921 * @since 1.7
7922 * @deprecated ​ Deprecated. Use \`{@link JQuery.Event }\` in place of \`{@link JQueryEventObject }\`.
7923 * @example ​ ````Display a paragraph&#39;s text in an alert when it is clicked:
7924```javascript
7925$( "p" ).on( "click", function() {
7926 alert( $( this ).text() );
7927});
7928```
7929 * @example ​ ````Cancel a form submit action and prevent the event from bubbling up by returning false:
7930```javascript
7931$( "form" ).on( "submit", false );
7932```
7933 * @example ​ ````Cancel only the default action by using .preventDefault().
7934```javascript
7935$( "form" ).on( "submit", function( event ) {
7936 event.preventDefault();
7937});
7938```
7939 * @example ​ ````Stop submit events from bubbling without preventing form submit, using .stopPropagation().
7940```javascript
7941$( "form" ).on( "submit", function( event ) {
7942 event.stopPropagation();
7943});
7944```
7945 * @example ​ ````Pass data to the event handler using the second argument to .trigger()
7946```javascript
7947$( "div" ).on( "click", function( event, person ) {
7948 alert( "Hello, " + person.name );
7949});
7950$( "div" ).trigger( "click", { name: "Jim" } );
7951```
7952 * @example ​ ````Use the the second argument of .trigger() to pass an array of data to the event handler
7953```javascript
7954$( "div" ).on( "click", function( event, salutation, name ) {
7955 alert( salutation + ", " + name );
7956});
7957$( "div" ).trigger( "click", [ "Goodbye", "Jim" ] );
7958```
7959 * @example ​ ````Attach and trigger custom (non-browser) events.
7960```html
7961<!doctype html>
7962<html lang="en">
7963<head>
7964 <meta charset="utf-8">
7965 <title>on demo</title>
7966 <style>
7967 p {
7968 color: red;
7969 }
7970 span {
7971 color: blue;
7972 }
7973 </style>
7974 <script src="https://code.jquery.com/jquery-3.3.1.js"></script>
7975</head>
7976<body>
7977
7978<p>Has an attached custom event.</p>
7979<button>Trigger custom event</button>
7980<span style="display:none;"></span>
7981
7982<script>
7983$( "p" ).on( "myCustomEvent", function( event, myName ) {
7984 $( this ).text( myName + ", hi there!" );
7985 $( "span" )
7986 .stop()
7987 .css( "opacity", 1 )
7988 .text( "myName = " + myName )
7989 .fadeIn( 30 )
7990 .fadeOut( 1000 );
7991});
7992$( "button" ).click(function () {
7993 $( "p" ).trigger( "myCustomEvent", [ "John" ] );
7994});
7995</script>
7996
7997</body>
7998</html>
7999```
8000 * @example ​ ````Attach multiple events—one on mouseenter and one on mouseleave to the same element:
8001```javascript
8002$( "#cart" ).on( "mouseenter mouseleave", function( event ) {
8003 $( this ).toggleClass( "active" );
8004});
8005```
8006 */
8007 on(events: string,
8008 handler: ((event: JQueryEventObject) => void)): this;
8009 /**
8010 * Attach an event handler function for one or more events to the selected elements.
8011 * @param events An object in which the string keys represent one or more space-separated event types and optional
8012 * namespaces, and the values represent a handler function to be called for the event(s).
8013 * @param selector A selector string to filter the descendants of the selected elements that will call the handler. If
8014 * the selector is null or omitted, the handler is always called when it reaches the selected element.
8015 * @param data Data to be passed to the handler in event.data when an event occurs.
8016 * @see \`{@link https://api.jquery.com/on/ }\`
8017 * @since 1.7
8018 */
8019 on<TData>(
8020 events: JQuery.TypeEventHandlers<TElement, TData, any, any>,
8021 selector: JQuery.Selector,
8022 data: TData
8023 ): this;
8024 /**
8025 * Attach an event handler function for one or more events to the selected elements.
8026 * @param events An object in which the string keys represent one or more space-separated event types and optional
8027 * namespaces, and the values represent a handler function to be called for the event(s).
8028 * @param selector A selector string to filter the descendants of the selected elements that will call the handler. If
8029 * the selector is null or omitted, the handler is always called when it reaches the selected element.
8030 * @param data Data to be passed to the handler in event.data when an event occurs.
8031 * @see \`{@link https://api.jquery.com/on/ }\`
8032 * @since 1.7
8033 */
8034 on<TData>(
8035 events: JQuery.TypeEventHandlers<TElement, TData, TElement, TElement>,
8036 selector: null | undefined,
8037 data: TData
8038 ): this;
8039 /**
8040 * Attach an event handler function for one or more events to the selected elements.
8041 * @param events An object in which the string keys represent one or more space-separated event types and optional
8042 * namespaces, and the values represent a handler function to be called for the event(s).
8043 * @param selector A selector string to filter the descendants of the selected elements that will call the handler. If
8044 * the selector is null or omitted, the handler is always called when it reaches the selected element.
8045 * @see \`{@link https://api.jquery.com/on/ }\`
8046 * @since 1.7
8047 */
8048 on(events: JQuery.TypeEventHandlers<TElement, undefined, any, any>,
8049 selector: JQuery.Selector
8050 ): this;
8051 /**
8052 * Attach an event handler function for one or more events to the selected elements.
8053 * @param events An object in which the string keys represent one or more space-separated event types and optional
8054 * namespaces, and the values represent a handler function to be called for the event(s).
8055 * @param data Data to be passed to the handler in event.data when an event occurs.
8056 * @see \`{@link https://api.jquery.com/on/ }\`
8057 * @since 1.7
8058 */
8059 on<TData>(
8060 events: JQuery.TypeEventHandlers<TElement, TData, TElement, TElement>,
8061 data: TData
8062 ): this;
8063 /**
8064 * Attach an event handler function for one or more events to the selected elements.
8065 * @param events An object in which the string keys represent one or more space-separated event types and optional
8066 * namespaces, and the values represent a handler function to be called for the event(s).
8067 * @see \`{@link https://api.jquery.com/on/ }\`
8068 * @since 1.7
8069 * @example ​ ````Attach multiple event handlers simultaneously using a plain object.
8070```html
8071<!doctype html>
8072<html lang="en">
8073<head>
8074 <meta charset="utf-8">
8075 <title>on demo</title>
8076 <style>
8077 .test {
8078 color: #000;
8079 padding: .5em;
8080 border: 1px solid #444;
8081 }
8082 .active {
8083 color: #900;
8084 }
8085 .inside {
8086 background-color: aqua;
8087 }
8088 </style>
8089 <script src="https://code.jquery.com/jquery-3.3.1.js"></script>
8090</head>
8091<body>
8092
8093<div class="test">test div</div>
8094
8095<script>
8096$( "div.test" ).on({
8097 click: function() {
8098 $( this ).toggleClass( "active" );
8099 }, mouseenter: function() {
8100 $( this ).addClass( "inside" );
8101 }, mouseleave: function() {
8102 $( this ).removeClass( "inside" );
8103 }
8104});
8105</script>
8106
8107</body>
8108</html>
8109```
8110 */
8111 on(events: JQuery.TypeEventHandlers<TElement, undefined, TElement, TElement>): this;
8112 /**
8113 * Attach a handler to an event for the elements. The handler is executed at most once per element per event type.
8114 * @param events One or more space-separated event types and optional namespaces, such as "click" or "keydown.myPlugin".
8115 * @param selector A selector string to filter the descendants of the selected elements that trigger the event. If the
8116 * selector is null or omitted, the event is always triggered when it reaches the selected element.
8117 * @param data Data to be passed to the handler in event.data when an event is triggered.
8118 * @param handler A function to execute when the event is triggered.
8119 * @see \`{@link https://api.jquery.com/one/ }\`
8120 * @since 1.7
8121 */
8122 one<TType extends string,
8123 TData>(
8124 events: TType,
8125 selector: JQuery.Selector,
8126 data: TData,
8127 handler: JQuery.TypeEventHandler<TElement, TData, any, any, TType>
8128 ): this;
8129 /**
8130 * Attach a handler to an event for the elements. The handler is executed at most once per element per event type.
8131 * @param events One or more space-separated event types and optional namespaces, such as "click" or "keydown.myPlugin".
8132 * @param selector A selector string to filter the descendants of the selected elements that trigger the event. If the
8133 * selector is null or omitted, the event is always triggered when it reaches the selected element.
8134 * @param data Data to be passed to the handler in event.data when an event is triggered.
8135 * @param handler A function to execute when the event is triggered.
8136 * @see \`{@link https://api.jquery.com/one/ }\`
8137 * @since 1.7
8138 */
8139 one<TType extends string,
8140 TData>(
8141 events: TType,
8142 selector: null | undefined,
8143 data: TData,
8144 handler: JQuery.TypeEventHandler<TElement, TData, TElement, TElement, TType>
8145 ): this;
8146 /**
8147 * Attach a handler to an event for the elements. The handler is executed at most once per element per event type.
8148 * @param events One or more space-separated event types and optional namespaces, such as "click" or "keydown.myPlugin".
8149 * @param selector A selector string to filter the descendants of the selected elements that trigger the event. If the
8150 * selector is null or omitted, the event is always triggered when it reaches the selected element.
8151 * @param handler A function to execute when the event is triggered. The value false is also allowed as a shorthand
8152 * for a function that simply does return false.
8153 * @see \`{@link https://api.jquery.com/one/ }\`
8154 * @since 1.7
8155 */
8156 one<TType extends string>(
8157 events: TType,
8158 selector: JQuery.Selector,
8159 handler: JQuery.TypeEventHandler<TElement, undefined, any, any, TType> |
8160 false
8161 ): this;
8162 /**
8163 * Attach a handler to an event for the elements. The handler is executed at most once per element per event type.
8164 * @param events One or more space-separated event types and optional namespaces, such as "click" or "keydown.myPlugin".
8165 * @param data Data to be passed to the handler in event.data when an event is triggered.
8166 * @param handler A function to execute when the event is triggered.
8167 * @see \`{@link https://api.jquery.com/one/ }\`
8168 * @since 1.7
8169 */
8170 one<TType extends string,
8171 TData>(
8172 events: TType,
8173 data: TData,
8174 handler: JQuery.TypeEventHandler<TElement, TData, TElement, TElement, TType>
8175 ): this;
8176 /**
8177 * Attach a handler to an event for the elements. The handler is executed at most once per element per event type.
8178 * @param events One or more space-separated event types and optional namespaces, such as "click" or "keydown.myPlugin".
8179 * @param handler A function to execute when the event is triggered. The value false is also allowed as a shorthand
8180 * for a function that simply does return false.
8181 * @see \`{@link https://api.jquery.com/one/ }\`
8182 * @since 1.7
8183 * @example ​ ````Tie a one-time click to each div.
8184```html
8185<!doctype html>
8186<html lang="en">
8187<head>
8188 <meta charset="utf-8">
8189 <title>one demo</title>
8190 <style>
8191 div {
8192 width: 60px;
8193 height: 60px;
8194 margin: 5px;
8195 float: left;
8196 background: green;
8197 border: 10px outset;
8198 cursor:pointer;
8199 }
8200 p {
8201 color: red;
8202 margin: 0;
8203 clear: left;
8204 }
8205 </style>
8206 <script src="https://code.jquery.com/jquery-3.3.1.js"></script>
8207</head>
8208<body>
8209
8210<div></div>
8211<div></div>
8212<div></div>
8213<div></div>
8214<div></div>
8215<p>Click a green square...</p>
8216
8217<script>
8218var n = 0;
8219$( "div" ).one( "click", function() {
8220 var index = $( "div" ).index( this );
8221 $( this ).css({
8222 borderStyle: "inset",
8223 cursor: "auto"
8224 });
8225 $( "p" ).text( "Div at index #" + index + " clicked." +
8226 " That's " + (++n) + " total clicks." );
8227});
8228</script>
8229
8230</body>
8231</html>
8232```
8233 * @example ​ ````To display the text of all paragraphs in an alert box the first time each of them is clicked:
8234```javascript
8235$( "p" ).one( "click", function() {
8236 alert( $( this ).text() );
8237});
8238```
8239 * @example ​ ````Event handlers will trigger once per element per event type
8240```html
8241<!doctype html>
8242<html lang="en">
8243<head>
8244 <meta charset="utf-8">
8245 <title>one demo</title>
8246 <script src="https://code.jquery.com/jquery-3.3.1.js"></script>
8247</head>
8248<body>
8249
8250<div class="count">0</div>
8251<div class="target">Hover/click me</div>
8252
8253<script>
8254var n = 0;
8255$(".target").one("click mouseenter", function() {
8256 $(".count").html(++n);
8257});
8258</script>
8259
8260</body>
8261</html>
8262```
8263 */
8264 one<TType extends string>(
8265 events: TType,
8266 handler: JQuery.TypeEventHandler<TElement, undefined, TElement, TElement, TType>|
8267 false
8268 ): this;
8269 /**
8270 * Attach a handler to an event for the elements. The handler is executed at most once per element per event type.
8271 * @param events An object in which the string keys represent one or more space-separated event types and optional
8272 * namespaces, and the values represent a handler function to be called for the event(s).
8273 * @param selector A selector string to filter the descendants of the selected elements that will call the handler. If
8274 * the selector is null or omitted, the handler is always called when it reaches the selected element.
8275 * @param data Data to be passed to the handler in event.data when an event occurs.
8276 * @see \`{@link https://api.jquery.com/one/ }\`
8277 * @since 1.7
8278 */
8279 one<TData>(
8280 events: JQuery.TypeEventHandlers<TElement, TData, any, any>,
8281 selector: JQuery.Selector,
8282 data: TData
8283 ): this;
8284 /**
8285 * Attach a handler to an event for the elements. The handler is executed at most once per element per event type.
8286 * @param events An object in which the string keys represent one or more space-separated event types and optional
8287 * namespaces, and the values represent a handler function to be called for the event(s).
8288 * @param selector A selector string to filter the descendants of the selected elements that will call the handler. If
8289 * the selector is null or omitted, the handler is always called when it reaches the selected element.
8290 * @param data Data to be passed to the handler in event.data when an event occurs.
8291 * @see \`{@link https://api.jquery.com/one/ }\`
8292 * @since 1.7
8293 */
8294 one<TData>(
8295 events: JQuery.TypeEventHandlers<TElement, TData, TElement, TElement>,
8296 selector: null | undefined,
8297 data: TData
8298 ): this;
8299 /**
8300 * Attach a handler to an event for the elements. The handler is executed at most once per element per event type.
8301 * @param events An object in which the string keys represent one or more space-separated event types and optional
8302 * namespaces, and the values represent a handler function to be called for the event(s).
8303 * @param selector A selector string to filter the descendants of the selected elements that will call the handler. If
8304 * the selector is null or omitted, the handler is always called when it reaches the selected element.
8305 * @see \`{@link https://api.jquery.com/one/ }\`
8306 * @since 1.7
8307 */
8308 one(events: JQuery.TypeEventHandlers<TElement, undefined, any, any>,
8309 selector: JQuery.Selector): this;
8310 /**
8311 * Attach a handler to an event for the elements. The handler is executed at most once per element per event type.
8312 * @param events An object in which the string keys represent one or more space-separated event types and optional
8313 * namespaces, and the values represent a handler function to be called for the event(s).
8314 * @param data Data to be passed to the handler in event.data when an event occurs.
8315 * @see \`{@link https://api.jquery.com/one/ }\`
8316 * @since 1.7
8317 */
8318 one<TData>(
8319 events: JQuery.TypeEventHandlers<TElement, TData, TElement, TElement>,
8320 data: TData
8321 ): this;
8322 /**
8323 * Attach a handler to an event for the elements. The handler is executed at most once per element per event type.
8324 * @param events An object in which the string keys represent one or more space-separated event types and optional
8325 * namespaces, and the values represent a handler function to be called for the event(s).
8326 * @see \`{@link https://api.jquery.com/one/ }\`
8327 * @since 1.7
8328 */
8329 one(events: JQuery.TypeEventHandlers<TElement, undefined, TElement, TElement>): this;
8330 /**
8331 * Set the CSS outer height of each element in the set of matched elements.
8332 * @param value_function _&#x40;param_ `value_function`
8333 * <br>
8334 * * `value` — A number representing the number of pixels, or a number along with an optional unit of measure
8335 * appended (as a string). <br>
8336 * * `function` — A function returning the outer height to set. Receives the index position of the element in the set
8337 * and the old outer height as arguments. Within the function, `this` refers to the current element in
8338 * the set.
8339 * @see \`{@link https://api.jquery.com/outerHeight/ }\`
8340 * @since 1.8.0
8341 * @example ​ ````Change the outer height of each div the first time it is clicked (and change its color).
8342```html
8343<!doctype html>
8344<html lang="en">
8345<head>
8346 <meta charset="utf-8">
8347 <title>outerHeight demo</title>
8348 <style>
8349 div {
8350 width: 50px;
8351 padding: 10px;
8352 height: 60px;
8353 float: left;
8354 margin: 5px;
8355 background: red;
8356 cursor: pointer;
8357 }
8358 .mod {
8359 background: blue;
8360 cursor: default;
8361 }
8362 </style>
8363 <script src="https://code.jquery.com/jquery-3.3.1.js"></script>
8364</head>
8365<body>
8366
8367<div>d</div>
8368<div>d</div>
8369<div>d</div>
8370<div>d</div>
8371<div>d</div>
8372
8373<script>
8374var modHeight = 60;
8375$( "div" ).one( "click", function() {
8376 $( this ).outerHeight( modHeight ).addClass( "mod" );
8377 modHeight -= 8;
8378});
8379</script>
8380
8381</body>
8382</html>
8383```
8384 */
8385 outerHeight(value_function: string | number | ((this: TElement, index: number, height: number) => string | number),
8386 includeMargin?: boolean): this;
8387 /**
8388 * Get the current computed outer height (including padding, border, and optionally margin) for the first element in the set of matched elements.
8389 * @param includeMargin A Boolean indicating whether to include the element's margin in the calculation.
8390 * @see \`{@link https://api.jquery.com/outerHeight/ }\`
8391 * @since 1.2.6
8392 * @example ​ ````Get the outerHeight of a paragraph.
8393```html
8394<!doctype html>
8395<html lang="en">
8396<head>
8397 <meta charset="utf-8">
8398 <title>outerHeight demo</title>
8399 <style>
8400 p {
8401 margin: 10px;
8402 padding: 5px;
8403 border: 2px solid #666;
8404 }
8405 </style>
8406 <script src="https://code.jquery.com/jquery-3.3.1.js"></script>
8407</head>
8408<body>
8409
8410<p>Hello</p><p></p>
8411
8412<script>
8413var p = $( "p:first" );
8414$( "p:last" ).text(
8415 "outerHeight:" + p.outerHeight() +
8416 " , outerHeight( true ):" + p.outerHeight( true ) );
8417</script>
8418
8419</body>
8420</html>
8421```
8422 */
8423 outerHeight(includeMargin?: boolean): number | undefined;
8424 /**
8425 * Set the CSS outer width of each element in the set of matched elements.
8426 * @param value_function _&#x40;param_ `value_function`
8427 * <br>
8428 * * `value` — A number representing the number of pixels, or a number along with an optional unit of measure
8429 * appended (as a string). <br>
8430 * * `function` — A function returning the outer width to set. Receives the index position of the element in the set
8431 * and the old outer width as arguments. Within the function, `this` refers to the current element in
8432 * the set.
8433 * @see \`{@link https://api.jquery.com/outerWidth/ }\`
8434 * @since 1.8.0
8435 * @example ​ ````Change the outer width of each div the first time it is clicked (and change its color).
8436```html
8437<!doctype html>
8438<html lang="en">
8439<head>
8440 <meta charset="utf-8">
8441 <title>outerWidth demo</title>
8442 <style>
8443 div {
8444 width: 60px;
8445 padding: 10px;
8446 height: 50px;
8447 float: left;
8448 margin: 5px;
8449 background: red;
8450 cursor: pointer;
8451 }
8452 .mod {
8453 background: blue;
8454 cursor: default;
8455 }
8456 </style>
8457 <script src="https://code.jquery.com/jquery-3.3.1.js"></script>
8458</head>
8459<body>
8460
8461<div>d</div>
8462<div>d</div>
8463<div>d</div>
8464<div>d</div>
8465<div>d</div>
8466
8467<script>
8468var modWidth = 60;
8469$( "div" ).one( "click", function() {
8470 $( this ).outerWidth( modWidth ).addClass( "mod" );
8471 modWidth -= 8;
8472});
8473</script>
8474
8475</body>
8476</html>
8477```
8478 */
8479 outerWidth(value_function: string | number | ((this: TElement, index: number, width: number) => string | number),
8480 includeMargin?: boolean): this;
8481 /**
8482 * Get the current computed outer width (including padding, border, and optionally margin) for the first element in the set of matched elements.
8483 * @param includeMargin A Boolean indicating whether to include the element's margin in the calculation.
8484 * @see \`{@link https://api.jquery.com/outerWidth/ }\`
8485 * @since 1.2.6
8486 * @example ​ ````Get the outerWidth of a paragraph.
8487```html
8488<!doctype html>
8489<html lang="en">
8490<head>
8491 <meta charset="utf-8">
8492 <title>outerWidth demo</title>
8493 <style>
8494 p {
8495 margin: 10px;
8496 padding: 5px;
8497 border: 2px solid #666;
8498 }
8499 </style>
8500 <script src="https://code.jquery.com/jquery-3.3.1.js"></script>
8501</head>
8502<body>
8503
8504<p>Hello</p><p></p>
8505
8506<script>
8507var p = $( "p:first" );
8508$( "p:last" ).text(
8509 "outerWidth:" + p.outerWidth() +
8510 " , outerWidth( true ):" + p.outerWidth( true ) );
8511</script>
8512
8513</body>
8514</html>
8515```
8516 */
8517 outerWidth(includeMargin?: boolean): number | undefined;
8518 /**
8519 * Get the parent of each element in the current set of matched elements, optionally filtered by a selector.
8520 * @param selector A string containing a selector expression to match elements against.
8521 * @see \`{@link https://api.jquery.com/parent/ }\`
8522 * @since 1.0
8523 * @example ​ ````Shows the parent of each element as (parent &gt; child). Check the View Source to see the raw html.
8524```html
8525<!doctype html>
8526<html lang="en">
8527<head>
8528 <meta charset="utf-8">
8529 <title>parent demo</title>
8530 <style>
8531 div, p {
8532 margin: 10px;
8533 }
8534 </style>
8535 <script src="https://code.jquery.com/jquery-3.3.1.js"></script>
8536</head>
8537<body>
8538
8539<div>div,
8540 <span>span, </span>
8541 <b>b </b>
8542</div>
8543
8544<p>p,
8545 <span>span,
8546 <em>em </em>
8547 </span>
8548</p>
8549
8550<div>div,
8551 <strong>strong,
8552 <span>span, </span>
8553 <em>em,
8554 <b>b, </b>
8555 </em>
8556 </strong>
8557 <b>b </b>
8558</div>
8559
8560<script>
8561$( "*", document.body ).each(function() {
8562 var parentTag = $( this ).parent().get( 0 ).tagName;
8563 $( this ).prepend( document.createTextNode( parentTag + " > " ) );
8564});
8565</script>
8566
8567</body>
8568</html>
8569```
8570 * @example ​ ````Find the parent element of each paragraph with a class &quot;selected&quot;.
8571```html
8572<!doctype html>
8573<html lang="en">
8574<head>
8575 <meta charset="utf-8">
8576 <title>parent demo</title>
8577 <script src="https://code.jquery.com/jquery-3.3.1.js"></script>
8578</head>
8579<body>
8580
8581<div><p>Hello</p></div>
8582<div class="selected"><p>Hello Again</p></div>
8583
8584<script>
8585$( "p" ).parent( ".selected" ).css( "background", "yellow" );
8586</script>
8587
8588</body>
8589</html>
8590```
8591 */
8592 parent(selector?: JQuery.Selector): this;
8593 /**
8594 * Get the ancestors of each element in the current set of matched elements, optionally filtered by a selector.
8595 * @param selector A string containing a selector expression to match elements against.
8596 * @see \`{@link https://api.jquery.com/parents/ }\`
8597 * @since 1.0
8598 * @example ​ ````Find all parent elements of each b.
8599```html
8600<!doctype html>
8601<html lang="en">
8602<head>
8603 <meta charset="utf-8">
8604 <title>parents demo</title>
8605 <style>
8606 b, span, p, html body {
8607 padding: .5em;
8608 border: 1px solid;
8609 }
8610 b {
8611 color: blue;
8612 }
8613 strong {
8614 color: red;
8615 }
8616 </style>
8617 <script src="https://code.jquery.com/jquery-3.3.1.js"></script>
8618</head>
8619<body>
8620
8621<div>
8622 <p>
8623 <span>
8624 <b>My parents are: </b>
8625 </span>
8626 </p>
8627</div>
8628
8629<script>
8630var parentEls = $( "b" ).parents()
8631 .map(function() {
8632 return this.tagName;
8633 })
8634 .get()
8635 .join( ", " );
8636$( "b" ).append( "<strong>" + parentEls + "</strong>" );
8637</script>
8638
8639</body>
8640</html>
8641```
8642 * @example ​ ````Click to find all unique div parent elements of each span.
8643```html
8644<!doctype html>
8645<html lang="en">
8646<head>
8647 <meta charset="utf-8">
8648 <title>parents demo</title>
8649 <style>
8650 p, div, span {
8651 margin: 2px;
8652 padding: 1px;
8653 }
8654 div {
8655 border: 2px white solid;
8656 }
8657 span {
8658 cursor: pointer;
8659 font-size: 12px;
8660 }
8661 .selected {
8662 color: blue;
8663 }
8664 b {
8665 color: red;
8666 display: block;
8667 font-size: 14px;
8668 }
8669 </style>
8670 <script src="https://code.jquery.com/jquery-3.3.1.js"></script>
8671</head>
8672<body>
8673
8674<p>
8675 <div>
8676 <div><span>Hello</span></div>
8677 <span>Hello Again</span>
8678 </div>
8679 <div>
8680 <span>And Hello Again</span>
8681 </div>
8682 </p>
8683 <b>Click Hellos to toggle their parents.</b>
8684
8685<script>
8686function showParents() {
8687 $( "div" ).css( "border-color", "white" );
8688 var len = $( "span.selected" )
8689 .parents( "div" )
8690 .css( "border", "2px red solid" )
8691 .length;
8692 $( "b" ).text( "Unique div parents: " + len );
8693}
8694$( "span" ).click(function() {
8695 $( this ).toggleClass( "selected" );
8696 showParents();
8697});
8698</script>
8699
8700</body>
8701</html>
8702```
8703 */
8704 parents<K extends keyof HTMLElementTagNameMap>(selector: K | JQuery<K>): JQuery<HTMLElementTagNameMap[K]>;
8705 parents<K extends keyof SVGElementTagNameMap>(selector: K | JQuery<K>): JQuery<SVGElementTagNameMap[K]>;
8706 // tslint:disable-next-line:no-unnecessary-generics
8707 parents<E extends HTMLElement>(selector?: JQuery.Selector): JQuery<E>;
8708 /**
8709 * Get the ancestors of each element in the current set of matched elements, up to but not including the element matched by the selector, DOM node, or jQuery object.
8710 * @param selector_element _&#x40;param_ `selector_element`
8711 * <br>
8712 * * `selector` — A string containing a selector expression to indicate where to stop matching ancestor elements. <br>
8713 * * `element` — A DOM node or jQuery object indicating where to stop matching ancestor elements.
8714 * @param filter A string containing a selector expression to match elements against.
8715 * @see \`{@link https://api.jquery.com/parentsUntil/ }\`
8716 * @since 1.4
8717 * @since 1.6
8718 * @example ​ ````Find the ancestors of &lt;li class=&quot;item-a&quot;&gt; up to &lt;ul class=&quot;level-1&quot;&gt; and give them a red background color. Also, find ancestors of &lt;li class=&quot;item-2&quot;&gt; that have a class of &quot;yes&quot; up to &lt;ul class=&quot;level-1&quot;&gt; and give them a green border.
8719```html
8720<!doctype html>
8721<html lang="en">
8722<head>
8723 <meta charset="utf-8">
8724 <title>parentsUntil demo</title>
8725 <script src="https://code.jquery.com/jquery-3.3.1.js"></script>
8726</head>
8727<body>
8728
8729<ul class="level-1 yes">
8730 <li class="item-i">I</li>
8731 <li class="item-ii">II
8732 <ul class="level-2 yes">
8733 <li class="item-a">A</li>
8734 <li class="item-b">B
8735 <ul class="level-3">
8736 <li class="item-1">1</li>
8737 <li class="item-2">2</li>
8738 <li class="item-3">3</li>
8739 </ul>
8740 </li>
8741 <li class="item-c">C</li>
8742 </ul>
8743 </li>
8744 <li class="item-iii">III</li>
8745</ul>
8746
8747<script>
8748$( "li.item-a" )
8749 .parentsUntil( ".level-1" )
8750 .css( "background-color", "red" );
8751
8752$( "li.item-2" )
8753 .parentsUntil( $( "ul.level-1" ), ".yes" )
8754 .css( "border", "3px solid green" );
8755</script>
8756
8757</body>
8758</html>
8759```
8760 */
8761 parentsUntil(selector_element?: JQuery.Selector | Element | JQuery, filter?: JQuery.Selector): this;
8762 /**
8763 * Get the current coordinates of the first element in the set of matched elements, relative to the offset parent.
8764 * @see \`{@link https://api.jquery.com/position/ }\`
8765 * @since 1.2
8766 * @example ​ ````Access the position of the second paragraph:
8767```html
8768<!doctype html>
8769<html lang="en">
8770<head>
8771 <meta charset="utf-8">
8772 <title>position demo</title>
8773 <style>
8774 div {
8775 padding: 15px;
8776 }
8777 p {
8778 margin-left: 10px;
8779 }
8780 </style>
8781 <script src="https://code.jquery.com/jquery-3.3.1.js"></script>
8782</head>
8783<body>
8784
8785<div>
8786 <p>Hello</p>
8787</div>
8788<p></p>
8789
8790<script>
8791var p = $( "p:first" );
8792var position = p.position();
8793$( "p:last" ).text( "left: " + position.left + ", top: " + position.top );
8794</script>
8795
8796</body>
8797</html>
8798```
8799 */
8800 position(): JQuery.Coordinates;
8801 /**
8802 * Insert content, specified by the parameter, to the beginning of each element in the set of matched elements.
8803 * @param contents One or more additional DOM elements, text nodes, arrays of elements and text nodes, HTML strings, or
8804 * jQuery objects to insert at the beginning of each element in the set of matched elements.
8805 * @see \`{@link https://api.jquery.com/prepend/ }\`
8806 * @since 1.0
8807 * @example ​ ````Prepends some HTML to all paragraphs.
8808```html
8809<!doctype html>
8810<html lang="en">
8811<head>
8812 <meta charset="utf-8">
8813 <title>prepend demo</title>
8814 <style>
8815 p {
8816 background: yellow;
8817 }
8818 </style>
8819 <script src="https://code.jquery.com/jquery-3.3.1.js"></script>
8820</head>
8821<body>
8822
8823<p>there, friend!</p>
8824<p>amigo!</p>
8825
8826<script>
8827$( "p" ).prepend( "<b>Hello </b>" );
8828</script>
8829
8830</body>
8831</html>
8832```
8833 * @example ​ ````Prepends a DOM Element to all paragraphs.
8834```html
8835<!doctype html>
8836<html lang="en">
8837<head>
8838 <meta charset="utf-8">
8839 <title>prepend demo</title>
8840 <style>
8841 p {
8842 background: yellow;
8843 }
8844 </style>
8845 <script src="https://code.jquery.com/jquery-3.3.1.js"></script>
8846</head>
8847<body>
8848
8849<p>is what I'd say</p>
8850<p>is what I said</p>
8851
8852<script>
8853$( "p" ).prepend( document.createTextNode( "Hello " ) );
8854</script>
8855
8856</body>
8857</html>
8858```
8859 * @example ​ ````Prepends a jQuery object (similar to an Array of DOM Elements) to all paragraphs.
8860```html
8861<!doctype html>
8862<html lang="en">
8863<head>
8864 <meta charset="utf-8">
8865 <title>prepend demo</title>
8866 <style>
8867 p {
8868 background: yellow;
8869 }
8870 </style>
8871 <script src="https://code.jquery.com/jquery-3.3.1.js"></script>
8872</head>
8873<body>
8874
8875<p> is what was said.</p><b>Hello</b>
8876
8877<script>
8878$( "p" ).prepend( $( "b" ) );
8879</script>
8880
8881</body>
8882</html>
8883```
8884 */
8885 prepend(...contents: Array<JQuery.htmlString | JQuery.TypeOrArray<JQuery.Node | JQuery<JQuery.Node>>>): this;
8886 /**
8887 * Insert content, specified by the parameter, to the beginning of each element in the set of matched elements.
8888 * @param funсtion A function that returns an HTML string, DOM element(s), text node(s), or jQuery object to insert at
8889 * the beginning of each element in the set of matched elements. Receives the index position of the
8890 * element in the set and the old HTML value of the element as arguments. Within the function, `this`
8891 * refers to the current element in the set.
8892 * @see \`{@link https://api.jquery.com/prepend/ }\`
8893 * @since 1.4
8894 */
8895 prepend(funсtion: (this: TElement, index: number, html: string) => JQuery.htmlString | JQuery.TypeOrArray<JQuery.Node | JQuery<JQuery.Node>>): this;
8896 /**
8897 * Insert every element in the set of matched elements to the beginning of the target.
8898 * @param target A selector, element, HTML string, array of elements, or jQuery object; the matched set of elements
8899 * will be inserted at the beginning of the element(s) specified by this parameter.
8900 * @see \`{@link https://api.jquery.com/prependTo/ }\`
8901 * @since 1.0
8902 * @example ​ ````Prepend all spans to the element with the ID &quot;foo&quot; (Check .prepend() documentation for more examples)
8903```html
8904<!doctype html>
8905<html lang="en">
8906<head>
8907 <meta charset="utf-8">
8908 <title>prependTo demo</title>
8909 <style>
8910 div {
8911 background: yellow;
8912 }
8913 </style>
8914 <script src="https://code.jquery.com/jquery-3.3.1.js"></script>
8915</head>
8916<body>
8917
8918<div id="foo">FOO!</div>
8919<span>I have something to say... </span>
8920
8921<script>
8922$( "span" ).prependTo( "#foo" );
8923</script>
8924
8925</body>
8926</html>
8927```
8928 */
8929 prependTo(target: JQuery.Selector | JQuery.htmlString | JQuery.TypeOrArray<Element | DocumentFragment> | JQuery): this;
8930 /**
8931 * Get the immediately preceding sibling of each element in the set of matched elements. If a selector is provided, it retrieves the previous sibling only if it matches that selector.
8932 * @param selector A string containing a selector expression to match elements against.
8933 * @see \`{@link https://api.jquery.com/prev/ }\`
8934 * @since 1.0
8935 * @example ​ ````Find the very previous sibling of each div.
8936```html
8937<!doctype html>
8938<html lang="en">
8939<head>
8940 <meta charset="utf-8">
8941 <title>prev demo</title>
8942 <style>
8943 div {
8944 width: 40px;
8945 height: 40px;
8946 margin: 10px;
8947 float: left;
8948 border: 2px blue solid;
8949 padding: 2px;
8950 }
8951 span {
8952 font-size: 14px;
8953 }
8954 p {
8955 clear: left;
8956 margin: 10px;
8957 }
8958 </style>
8959 <script src="https://code.jquery.com/jquery-3.3.1.js"></script>
8960</head>
8961<body>
8962
8963<div></div>
8964<div></div>
8965<div><span>has child</span></div>
8966<div></div>
8967<div></div>
8968<div></div>
8969<div id="start"></div>
8970<div></div>
8971<p><button>Go to Prev</button></p>
8972
8973<script>
8974var $curr = $( "#start" );
8975$curr.css( "background", "#f99" );
8976$( "button" ).click(function() {
8977 $curr = $curr.prev();
8978 $( "div" ).css( "background", "" );
8979 $curr.css( "background", "#f99" );
8980});
8981</script>
8982
8983</body>
8984</html>
8985```
8986 * @example ​ ````For each paragraph, find the very previous sibling that has a class &quot;selected&quot;.
8987```html
8988<!doctype html>
8989<html lang="en">
8990<head>
8991 <meta charset="utf-8">
8992 <title>prev demo</title>
8993 <script src="https://code.jquery.com/jquery-3.3.1.js"></script>
8994</head>
8995<body>
8996
8997<div><span>Hello</span></div>
8998<p class="selected">Hello Again</p>
8999<p>And Again</p>
9000
9001<script>
9002$( "p" ).prev( ".selected" ).css( "background", "yellow" );
9003</script>
9004
9005</body>
9006</html>
9007```
9008 */
9009 prev(selector?: JQuery.Selector): this;
9010 /**
9011 * Get all preceding siblings of each element in the set of matched elements, optionally filtered by a selector.
9012 * @param selector A string containing a selector expression to match elements against.
9013 * @see \`{@link https://api.jquery.com/prevAll/ }\`
9014 * @since 1.2
9015 * @example ​ ````Locate all the divs preceding the last div and give them a class.
9016```html
9017<!doctype html>
9018<html lang="en">
9019<head>
9020 <meta charset="utf-8">
9021 <title>prevAll demo</title>
9022 <style>
9023 div {
9024 width: 70px;
9025 height: 70px;
9026 background: #abc;
9027 border: 2px solid black;
9028 margin: 10px;
9029 float: left;
9030 }
9031 div.before {
9032 border-color: red;
9033 }
9034 </style>
9035 <script src="https://code.jquery.com/jquery-3.3.1.js"></script>
9036</head>
9037<body>
9038
9039<div></div>
9040<div></div>
9041<div></div>
9042<div></div>
9043
9044<script>
9045$( "div:last" ).prevAll().addClass( "before" );
9046</script>
9047
9048</body>
9049</html>
9050```
9051 */
9052 prevAll(selector?: JQuery.Selector): this;
9053 /**
9054 * Get all preceding siblings of each element up to but not including the element matched by the selector, DOM node, or jQuery object.
9055 * @param selector_element _&#x40;param_ `selector_element`
9056 * <br>
9057 * * `selector` — A string containing a selector expression to indicate where to stop matching preceding sibling elements. <br>
9058 * * `element` — A DOM node or jQuery object indicating where to stop matching preceding sibling elements.
9059 * @param filter A string containing a selector expression to match elements against.
9060 * @see \`{@link https://api.jquery.com/prevUntil/ }\`
9061 * @since 1.4
9062 * @since 1.6
9063 * @example ​ ````Find the siblings that precede &lt;dt id=&quot;term-2&quot;&gt; up to the preceding &lt;dt&gt; and give them a red background color. Also, find previous &lt;dd&gt; siblings of &lt;dt id=&quot;term-3&quot;&gt; up to &lt;dt id=&quot;term-1&quot;&gt; and give them a green text color.
9064```html
9065<!doctype html>
9066<html lang="en">
9067<head>
9068 <meta charset="utf-8">
9069 <title>prevUntil demo</title>
9070 <script src="https://code.jquery.com/jquery-3.3.1.js"></script>
9071</head>
9072<body>
9073
9074<dl>
9075 <dt id="term-1">term 1</dt>
9076 <dd>definition 1-a</dd>
9077 <dd>definition 1-b</dd>
9078 <dd>definition 1-c</dd>
9079 <dd>definition 1-d</dd>
9080
9081 <dt id="term-2">term 2</dt>
9082 <dd>definition 2-a</dd>
9083 <dd>definition 2-b</dd>
9084 <dd>definition 2-c</dd>
9085
9086 <dt id="term-3">term 3</dt>
9087 <dd>definition 3-a</dd>
9088 <dd>definition 3-b</dd>
9089</dl>
9090
9091<script>
9092$( "#term-2" ).prevUntil( "dt" )
9093 .css( "background-color", "red" );
9094
9095var term1 = document.getElementById( "term-1" );
9096$( "#term-3" ).prevUntil( term1, "dd" )
9097 .css( "color", "green" );
9098</script>
9099
9100</body>
9101</html>
9102```
9103 */
9104 prevUntil(selector_element?: JQuery.Selector | Element | JQuery, filter?: JQuery.Selector): this;
9105 /**
9106 * Return a Promise object to observe when all actions of a certain type bound to the collection, queued or not, have finished.
9107 * @param type The type of queue that needs to be observed.
9108 * @param target Object onto which the promise methods have to be attached
9109 * @see \`{@link https://api.jquery.com/promise/ }\`
9110 * @since 1.6
9111 */
9112 promise<T extends object>(type: string, target: T): T & JQuery.Promise<this>;
9113 /**
9114 * Return a Promise object to observe when all actions of a certain type bound to the collection, queued or not, have finished.
9115 * @param target Object onto which the promise methods have to be attached
9116 * @see \`{@link https://api.jquery.com/promise/ }\`
9117 * @since 1.6
9118 */
9119 promise<T extends object>(target: T): T & JQuery.Promise<this>;
9120 /**
9121 * Return a Promise object to observe when all actions of a certain type bound to the collection, queued or not, have finished.
9122 * @param type The type of queue that needs to be observed.
9123 * @see \`{@link https://api.jquery.com/promise/ }\`
9124 * @since 1.6
9125 * @example ​ ````Using .promise() on a collection with no active animation returns a resolved Promise:
9126```javascript
9127var div = $( "<div>" );
9128
9129div.promise().done(function( arg1 ) {
9130 // Will fire right away and alert "true"
9131 alert( this === div && arg1 === div );
9132});
9133```
9134 * @example ​ ````Resolve the returned Promise when all animations have ended (including those initiated in the animation callback or added later on):
9135```html
9136<!doctype html>
9137<html lang="en">
9138<head>
9139 <meta charset="utf-8">
9140 <title>promise demo</title>
9141 <style>
9142 div {
9143 height: 50px;
9144 width: 50px;
9145 float: left;
9146 margin-right: 10px;
9147 display: none;
9148 background-color: #090;
9149 }
9150 </style>
9151 <script src="https://code.jquery.com/jquery-3.3.1.js"></script>
9152</head>
9153<body>
9154
9155<button>Go</button>
9156<p>Ready...</p>
9157<div></div>
9158<div></div>
9159<div></div>
9160<div></div>
9161
9162<script>
9163$( "button" ).on( "click", function() {
9164 $( "p" ).append( "Started..." );
9165
9166 $( "div" ).each(function( i ) {
9167 $( this ).fadeIn().fadeOut( 1000 * ( i + 1 ) );
9168 });
9169
9170 $( "div" ).promise().done(function() {
9171 $( "p" ).append( " Finished! " );
9172 });
9173});
9174</script>
9175
9176</body>
9177</html>
9178```
9179 * @example ​ ````Resolve the returned Promise using a $.when() statement (the .promise() method makes it possible to do this with jQuery collections):
9180```html
9181<!doctype html>
9182<html lang="en">
9183<head>
9184 <meta charset="utf-8">
9185 <title>promise demo</title>
9186 <style>
9187 div {
9188 height: 50px;
9189 width: 50px;
9190 float: left;
9191 margin-right: 10px;
9192 display: none;
9193 background-color: #090;
9194 }
9195 </style>
9196 <script src="https://code.jquery.com/jquery-3.3.1.js"></script>
9197</head>
9198<body>
9199
9200<button>Go</button>
9201<p>Ready...</p>
9202<div></div>
9203<div></div>
9204<div></div>
9205<div></div>
9206
9207<script>
9208var effect = function() {
9209 return $( "div" ).fadeIn( 800 ).delay( 1200 ).fadeOut();
9210};
9211
9212$( "button" ).on( "click", function() {
9213 $( "p" ).append( " Started... " );
9214
9215 $.when( effect() ).done(function() {
9216 $( "p" ).append( " Finished! " );
9217 });
9218});
9219</script>
9220
9221</body>
9222</html>
9223```
9224 */
9225 promise(type?: string): JQuery.Promise<this>;
9226 /**
9227 * Set one or more properties for the set of matched elements.
9228 * @param propertyName The name of the property to set.
9229 * @param value_function _&#x40;param_ `value_function`
9230 * <br>
9231 * * `value` — A value to set for the property. <br>
9232 * * `function` — A function returning the value to set. Receives the index position of the element in the set and the
9233 * old property value as arguments. Within the function, the keyword `this` refers to the current element.
9234 * @see \`{@link https://api.jquery.com/prop/ }\`
9235 * @since 1.6
9236 */
9237 prop(propertyName: string,
9238 value_function: string | number | boolean | symbol | object | null | undefined | ((this: TElement, index: number, oldPropertyValue: any) => any)): this;
9239 /**
9240 * Set one or more properties for the set of matched elements.
9241 * @param properties An object of property-value pairs to set.
9242 * @see \`{@link https://api.jquery.com/prop/ }\`
9243 * @since 1.6
9244 * @example ​ ````Disable all checkboxes on the page.
9245```html
9246<!doctype html>
9247<html lang="en">
9248<head>
9249 <meta charset="utf-8">
9250 <title>prop demo</title>
9251 <style>
9252 img {
9253 padding: 10px;
9254 }
9255 div {
9256 color: red;
9257 font-size: 24px;
9258 }
9259 </style>
9260 <script src="https://code.jquery.com/jquery-3.3.1.js"></script>
9261</head>
9262<body>
9263
9264 <input type="checkbox" checked="checked">
9265 <input type="checkbox">
9266 <input type="checkbox">
9267 <input type="checkbox" checked="checked">
9268
9269<script>
9270$( "input[type='checkbox']" ).prop({
9271 disabled: true
9272});
9273</script>
9274
9275</body>
9276</html>
9277```
9278 */
9279 prop(properties: JQuery.PlainObject): this;
9280 /**
9281 * Get the value of a property for the first element in the set of matched elements.
9282 * @param propertyName The name of the property to get.
9283 * @see \`{@link https://api.jquery.com/prop/ }\`
9284 * @since 1.6
9285 * @example ​ ````Display the checked property and attribute of a checkbox as it changes.
9286```html
9287<!doctype html>
9288<html lang="en">
9289<head>
9290 <meta charset="utf-8">
9291 <title>prop demo</title>
9292 <style>
9293 p {
9294 margin: 20px 0 0;
9295 }
9296 b {
9297 color: blue;
9298 }
9299 </style>
9300 <script src="https://code.jquery.com/jquery-3.3.1.js"></script>
9301</head>
9302<body>
9303
9304<input id="check1" type="checkbox" checked="checked">
9305<label for="check1">Check me</label>
9306<p></p>
9307
9308<script>
9309$( "input" ).change(function() {
9310 var $input = $( this );
9311 $( "p" ).html(
9312 ".attr( \"checked\" ): <b>" + $input.attr( "checked" ) + "</b><br>" +
9313 ".prop( \"checked\" ): <b>" + $input.prop( "checked" ) + "</b><br>" +
9314 ".is( \":checked\" ): <b>" + $input.is( ":checked" ) + "</b>" );
9315}).change();
9316</script>
9317
9318</body>
9319</html>
9320```
9321 */
9322 prop(propertyName: string): any;
9323 /**
9324 * Add a collection of DOM elements onto the jQuery stack.
9325 * @param elements An array of elements to push onto the stack and make into a new jQuery object.
9326 * @param name The name of a jQuery method that generated the array of elements.
9327 * @param args The arguments that were passed in to the jQuery method (for serialization).
9328 * @see \`{@link https://api.jquery.com/pushStack/ }\`
9329 * @since 1.3
9330 */
9331 pushStack(elements: ArrayLike<Element>, name: string, args: any[]): this;
9332 /**
9333 * Add a collection of DOM elements onto the jQuery stack.
9334 * @param elements An array of elements to push onto the stack and make into a new jQuery object.
9335 * @see \`{@link https://api.jquery.com/pushStack/ }\`
9336 * @since 1.0
9337 * @example ​ ````Add some elements onto the jQuery stack, then pop back off again.
9338```javascript
9339jQuery([])
9340 .pushStack( document.getElementsByTagName( "div" ) )
9341 .remove()
9342 .end();
9343```
9344 */
9345 pushStack(elements: ArrayLike<Element>): this;
9346 /**
9347 * Manipulate the queue of functions to be executed, once for each matched element.
9348 * @param queueName A string containing the name of the queue. Defaults to fx, the standard effects queue.
9349 * @param newQueue The new function to add to the queue, with a function to call that will dequeue the next item.
9350 * An array of functions to replace the current queue contents.
9351 * @see \`{@link https://api.jquery.com/queue/ }\`
9352 * @since 1.2
9353 * @example ​ ````Set a queue array to delete the queue.
9354```html
9355<!doctype html>
9356<html lang="en">
9357<head>
9358 <meta charset="utf-8">
9359 <title>queue demo</title>
9360 <style>
9361 div {
9362 margin: 3px;
9363 width: 40px;
9364 height: 40px;
9365 position: absolute;
9366 left: 0px;
9367 top: 30px;
9368 background: green;
9369 display: none;
9370 }
9371 div.newcolor {
9372 background: blue;
9373 }
9374 </style>
9375 <script src="https://code.jquery.com/jquery-3.3.1.js"></script>
9376</head>
9377<body>
9378
9379<button id="start">Start</button>
9380<button id="stop">Stop</button>
9381<div></div>
9382
9383<script>
9384$( "#start" ).click(function() {
9385 $( "div" )
9386 .show( "slow" )
9387 .animate({ left: "+=200" }, 5000 )
9388 .queue(function() {
9389 $( this ).addClass( "newcolor" ).dequeue();
9390 })
9391 .animate({ left: '-=200' }, 1500 )
9392 .queue(function() {
9393 $( this ).removeClass( "newcolor" ).dequeue();
9394 })
9395 .slideUp();
9396});
9397$( "#stop" ).click(function() {
9398 $( "div" )
9399 .queue( "fx", [] )
9400 .stop();
9401});
9402</script>
9403
9404</body>
9405</html>
9406```
9407 */
9408 queue(queueName: string, newQueue: JQuery.TypeOrArray<JQuery.QueueFunction<TElement>>): this;
9409 /**
9410 * Manipulate the queue of functions to be executed, once for each matched element.
9411 * @param newQueue The new function to add to the queue, with a function to call that will dequeue the next item.
9412 * An array of functions to replace the current queue contents.
9413 * @see \`{@link https://api.jquery.com/queue/ }\`
9414 * @since 1.2
9415 * @example ​ ````Queue a custom function.
9416```html
9417<!doctype html>
9418<html lang="en">
9419<head>
9420 <meta charset="utf-8">
9421 <title>queue demo</title>
9422 <style>
9423 div {
9424 margin: 3px;
9425 width: 40px;
9426 height: 40px;
9427 position: absolute;
9428 left: 0px;
9429 top: 30px;
9430 background: green;
9431 display: none;
9432 }
9433 div.newcolor {
9434 background: blue;
9435 }
9436 </style>
9437 <script src="https://code.jquery.com/jquery-3.3.1.js"></script>
9438</head>
9439<body>
9440
9441Click here...
9442<div></div>
9443
9444<script>
9445$( document.body ).click(function() {
9446 $( "div" )
9447 .show( "slow" )
9448 .animate({ left: "+=200" }, 2000 )
9449 .queue(function() {
9450 $( this ).addClass( "newcolor" ).dequeue();
9451 })
9452 .animate({ left: "-=200" }, 500 )
9453 .queue(function() {
9454 $( this ).removeClass( "newcolor" ).dequeue();
9455 })
9456 .slideUp();
9457});
9458</script>
9459
9460</body>
9461</html>
9462```
9463 */
9464 queue(newQueue: JQuery.TypeOrArray<JQuery.QueueFunction<TElement>>): this;
9465 /**
9466 * Show the queue of functions to be executed on the matched elements.
9467 * @param queueName A string containing the name of the queue. Defaults to fx, the standard effects queue.
9468 * @see \`{@link https://api.jquery.com/queue/ }\`
9469 * @since 1.2
9470 * @example ​ ````Show the length of the queue.
9471```html
9472<!doctype html>
9473<html lang="en">
9474<head>
9475 <meta charset="utf-8">
9476 <title>queue demo</title>
9477 <style>
9478 div {
9479 margin: 3px;
9480 width: 40px;
9481 height: 40px;
9482 position: absolute;
9483 left: 0px;
9484 top: 60px;
9485 background: green;
9486 display: none;
9487 }
9488 div.newcolor {
9489 background: blue;
9490 }
9491 p {
9492 color: red;
9493 }
9494 </style>
9495 <script src="https://code.jquery.com/jquery-3.3.1.js"></script>
9496</head>
9497<body>
9498
9499<p>The queue length is: <span></span></p>
9500<div></div>
9501
9502<script>
9503var div = $( "div" );
9504
9505function runIt() {
9506 div
9507 .show( "slow" )
9508 .animate({ left: "+=200" }, 2000 )
9509 .slideToggle( 1000 )
9510 .slideToggle( "fast" )
9511 .animate({ left: "-=200" }, 1500 )
9512 .hide( "slow" )
9513 .show( 1200 )
9514 .slideUp( "normal", runIt );
9515}
9516
9517function showIt() {
9518 var n = div.queue( "fx" );
9519 $( "span" ).text( n.length );
9520 setTimeout( showIt, 100 );
9521}
9522
9523runIt();
9524showIt();
9525</script>
9526
9527</body>
9528</html>
9529```
9530 */
9531 queue(queueName?: string): JQuery.Queue<Node>;
9532 /**
9533 * Specify a function to execute when the DOM is fully loaded.
9534 * @param handler A function to execute after the DOM is ready.
9535 * @see \`{@link https://api.jquery.com/ready/ }\`
9536 * @since 1.0
9537 * @deprecated ​ Deprecated since 3.0. Use `jQuery(function() { })`.
9538 * @example ​ ````Display a message when the DOM is loaded.
9539```html
9540<!doctype html>
9541<html lang="en">
9542<head>
9543 <meta charset="utf-8">
9544 <title>ready demo</title>
9545 <style>
9546 p {
9547 color: red;
9548 }
9549 </style>
9550 <script src="https://code.jquery.com/jquery-3.3.1.js"></script>
9551 <script>
9552
9553 $(function() {
9554 $( "p" ).text( "The DOM is now loaded and can be manipulated." );
9555 });
9556
9557 </script>
9558</head>
9559<body>
9560
9561<p>Not loaded yet.</p>
9562
9563</body>
9564</html>
9565```
9566 */
9567 ready(handler: ($: JQueryStatic) => void): this;
9568 /**
9569 * Remove the set of matched elements from the DOM.
9570 * @param selector A selector expression that filters the set of matched elements to be removed.
9571 * @see \`{@link https://api.jquery.com/remove/ }\`
9572 * @since 1.0
9573 * @example ​ ````Removes all paragraphs from the DOM
9574```html
9575<!doctype html>
9576<html lang="en">
9577<head>
9578 <meta charset="utf-8">
9579 <title>remove demo</title>
9580 <style>
9581 p {
9582 background: yellow;
9583 margin: 6px 0;
9584 }
9585 </style>
9586 <script src="https://code.jquery.com/jquery-3.3.1.js"></script>
9587</head>
9588<body>
9589
9590<p>Hello</p>
9591how are
9592<p>you?</p>
9593<button>Call remove() on paragraphs</button>
9594
9595<script>
9596$( "button" ).click(function() {
9597 $( "p" ).remove();
9598});
9599</script>
9600
9601</body>
9602</html>
9603```
9604 * @example ​ ````Removes all paragraphs that contain &quot;Hello&quot; from the DOM. Analogous to doing $(&quot;p&quot;).filter(&quot;:contains(&#39;Hello&#39;)&quot;).remove().
9605```html
9606<!doctype html>
9607<html lang="en">
9608<head>
9609 <meta charset="utf-8">
9610 <title>remove demo</title>
9611 <style>
9612 p {
9613 background: yellow;
9614 margin: 6px 0;
9615 }
9616 </style>
9617 <script src="https://code.jquery.com/jquery-3.3.1.js"></script>
9618</head>
9619<body>
9620
9621<p class="hello">Hello</p>
9622how are
9623<p>you?</p>
9624<button>Call remove( ":contains('Hello')" ) on paragraphs</button>
9625
9626<script>
9627$( "button" ).click(function() {
9628 $( "p" ).remove( ":contains('Hello')" );
9629});
9630</script>
9631
9632</body>
9633</html>
9634```
9635 */
9636 remove(selector?: string): this;
9637 /**
9638 * Remove an attribute from each element in the set of matched elements.
9639 * @param attributeName An attribute to remove; as of version 1.7, it can be a space-separated list of attributes.
9640 * @see \`{@link https://api.jquery.com/removeAttr/ }\`
9641 * @since 1.0
9642 * @example ​ ````Clicking the button changes the title of the input next to it. Move the mouse pointer over the text input to see the effect of adding and removing the title attribute.
9643```html
9644<!doctype html>
9645<html lang="en">
9646<head>
9647 <meta charset="utf-8">
9648 <title>removeAttr demo</title>
9649 <script src="https://code.jquery.com/jquery-3.3.1.js"></script>
9650</head>
9651<body>
9652
9653<button>Change title</button>
9654<input type="text" title="hello there">
9655<div id="log"></div>
9656
9657<script>
9658(function() {
9659 var inputTitle = $( "input" ).attr( "title" );
9660 $( "button" ).click(function() {
9661 var input = $( this ).next();
9662
9663 if ( input.attr( "title" ) === inputTitle ) {
9664 input.removeAttr( "title" )
9665 } else {
9666 input.attr( "title", inputTitle );
9667 }
9668
9669 $( "#log" ).html( "input title is now " + input.attr( "title" ) );
9670 });
9671})();
9672</script>
9673
9674</body>
9675</html>
9676```
9677 */
9678 removeAttr(attributeName: string): this;
9679 /**
9680 * Remove a single class, multiple classes, or all classes from each element in the set of matched elements.
9681 * @param className_function _&#x40;param_ `className_function`
9682 * <br>
9683 * * `className` — One or more space-separated classes to be removed from the class attribute of each matched element. <br>
9684 * * `function` — A function returning one or more space-separated class names to be removed. Receives the index
9685 * position of the element in the set and the old class value as arguments.
9686 * @see \`{@link https://api.jquery.com/removeClass/ }\`
9687 * @since 1.0
9688 * @since 1.4
9689 * @since 3.3
9690 * @example ​ ````Remove the class &#39;blue&#39; from the matched elements.
9691```html
9692<!doctype html>
9693<html lang="en">
9694<head>
9695 <meta charset="utf-8">
9696 <title>removeClass demo</title>
9697 <style>
9698 p {
9699 margin: 4px;
9700 font-size: 16px;
9701 font-weight: bolder;
9702 }
9703 .blue {
9704 color: blue;
9705 }
9706 .under {
9707 text-decoration: underline;
9708 }
9709 .highlight {
9710 background: yellow;
9711 }
9712 </style>
9713 <script src="https://code.jquery.com/jquery-3.3.1.js"></script>
9714</head>
9715<body>
9716
9717<p class="blue under">Hello</p>
9718<p class="blue under highlight">and</p>
9719<p class="blue under">then</p>
9720<p class="blue under">Goodbye</p>
9721
9722<script>
9723$( "p:even" ).removeClass( "blue" );
9724</script>
9725
9726</body>
9727</html>
9728```
9729 * @example ​ ````Remove the class &#39;blue&#39; and &#39;under&#39; from the matched elements.
9730```html
9731<!doctype html>
9732<html lang="en">
9733<head>
9734 <meta charset="utf-8">
9735 <title>removeClass demo</title>
9736 <style>
9737 p {
9738 margin: 4px;
9739 font-size: 16px;
9740 font-weight: bolder;
9741 }
9742 .blue {
9743 color: blue;
9744 }
9745 .under {
9746 text-decoration: underline;
9747 }
9748 .highlight {
9749 background: yellow;
9750 }
9751 </style>
9752 <script src="https://code.jquery.com/jquery-3.3.1.js"></script>
9753</head>
9754<body>
9755
9756<p class="blue under">Hello</p>
9757<p class="blue under highlight">and</p>
9758<p class="blue under">then</p>
9759<p class="blue under">Goodbye</p>
9760
9761<script>
9762$( "p:odd" ).removeClass( "blue under" );
9763</script>
9764
9765</body>
9766</html>
9767```
9768 * @example ​ ````Remove all the classes from the matched elements.
9769```html
9770<!doctype html>
9771<html lang="en">
9772<head>
9773 <meta charset="utf-8">
9774 <title>removeClass demo</title>
9775 <style>
9776 p {
9777 margin: 4px;
9778 font-size: 16px;
9779 font-weight: bolder;
9780 }
9781 .blue {
9782 color: blue;
9783 }
9784 .under {
9785 text-decoration: underline;
9786 }
9787 .highlight {
9788 background: yellow;
9789 }
9790 </style>
9791 <script src="https://code.jquery.com/jquery-3.3.1.js"></script>
9792</head>
9793<body>
9794
9795<p class="blue under">Hello</p>
9796<p class="blue under highlight">and</p>
9797<p class="blue under">then</p>
9798<p class="blue under">Goodbye</p>
9799
9800<script>
9801$( "p:eq(1)" ).removeClass();
9802</script>
9803
9804</body>
9805</html>
9806```
9807 */
9808 removeClass(className_function?: JQuery.TypeOrArray<string> | ((this: TElement, index: number, className: string) => string)): this;
9809 /**
9810 * Remove a previously-stored piece of data.
9811 * @param name A string naming the piece of data to delete.
9812 * An array or space-separated string naming the pieces of data to delete.
9813 * @see \`{@link https://api.jquery.com/removeData/ }\`
9814 * @since 1.2.3
9815 * @since 1.7
9816 * @example ​ ````Set a data store for 2 names then remove one of them.
9817```html
9818<!doctype html>
9819<html lang="en">
9820<head>
9821 <meta charset="utf-8">
9822 <title>removeData demo</title>
9823 <style>
9824 div {
9825 margin: 2px;
9826 color: blue;
9827 }
9828 span {
9829 color: red;
9830 }
9831 </style>
9832 <script src="https://code.jquery.com/jquery-3.3.1.js"></script>
9833</head>
9834<body>
9835
9836<div>value1 before creation: <span></span></div>
9837<div>value1 after creation: <span></span></div>
9838<div>value1 after removal: <span></span></div>
9839<div>value2 after removal: <span></span></div>
9840
9841<script>
9842$( "span:eq(0)" ).text( "" + $( "div" ).data( "test1" ) );
9843$( "div" ).data( "test1", "VALUE-1" );
9844$( "div" ).data( "test2", "VALUE-2" );
9845$( "span:eq(1)" ).text( "" + $( "div").data( "test1" ) );
9846$( "div" ).removeData( "test1" );
9847$( "span:eq(2)" ).text( "" + $( "div" ).data( "test1" ) );
9848$( "span:eq(3)" ).text( "" + $( "div" ).data( "test2" ) );
9849</script>
9850
9851</body>
9852</html>
9853```
9854 */
9855 removeData(name?: JQuery.TypeOrArray<string>): this;
9856 /**
9857 * Remove a property for the set of matched elements.
9858 * @param propertyName The name of the property to remove.
9859 * @see \`{@link https://api.jquery.com/removeProp/ }\`
9860 * @since 1.6
9861 * @example ​ ````Set a numeric property on a paragraph and then remove it.
9862```html
9863<!doctype html>
9864<html lang="en">
9865<head>
9866 <meta charset="utf-8">
9867 <title>removeProp demo</title>
9868 <style>
9869 img {
9870 padding: 10px;
9871 }
9872 div {
9873 color: red;
9874 font-size: 24px;
9875 }
9876 </style>
9877 <script src="https://code.jquery.com/jquery-3.3.1.js"></script>
9878</head>
9879<body>
9880
9881 <p></p>
9882
9883<script>
9884para = $( "p" );
9885para
9886 .prop( "luggageCode", 1234 )
9887 .append( "The secret luggage code is: ", String( para.prop( "luggageCode" ) ), ". " )
9888 .removeProp( "luggageCode" )
9889 .append( "Now the secret luggage code is: ", String( para.prop( "luggageCode" ) ), ". " );
9890</script>
9891
9892</body>
9893</html>
9894```
9895 */
9896 removeProp(propertyName: string): this;
9897 /**
9898 * Replace each target element with the set of matched elements.
9899 * @param target A selector string, jQuery object, DOM element, or array of elements indicating which element(s) to replace.
9900 * @see \`{@link https://api.jquery.com/replaceAll/ }\`
9901 * @since 1.2
9902 * @example ​ ````Replace all the paragraphs with bold words.
9903```html
9904<!doctype html>
9905<html lang="en">
9906<head>
9907 <meta charset="utf-8">
9908 <title>replaceAll demo</title>
9909 <script src="https://code.jquery.com/jquery-3.3.1.js"></script>
9910</head>
9911<body>
9912
9913<p>Hello</p>
9914<p>cruel</p>
9915<p>World</p>
9916
9917<script>
9918$( "<b>Paragraph. </b>" ).replaceAll( "p" );
9919</script>
9920
9921</body>
9922</html>
9923```
9924 */
9925 replaceAll(target: JQuery.Selector | JQuery | JQuery.TypeOrArray<Element>): this;
9926 /**
9927 * Replace each element in the set of matched elements with the provided new content and return the set of elements that was removed.
9928 * @param newContent_function _&#x40;param_ `newContent_function`
9929 * <br>
9930 * * `newContent` — The content to insert. May be an HTML string, DOM element, array of DOM elements, or jQuery object. <br>
9931 * * `function` — A function that returns content with which to replace the set of matched elements.
9932 * @see \`{@link https://api.jquery.com/replaceWith/ }\`
9933 * @since 1.2
9934 * @since 1.4
9935 * @example ​ ````On click, replace the button with a div containing the same word.
9936```html
9937<!doctype html>
9938<html lang="en">
9939<head>
9940 <meta charset="utf-8">
9941 <title>replaceWith demo</title>
9942 <style>
9943 button {
9944 display: block;
9945 margin: 3px;
9946 color: red;
9947 width: 200px;
9948 }
9949 div {
9950 color: red;
9951 border: 2px solid blue;
9952 width: 200px;
9953 margin: 3px;
9954 text-align: center;
9955 }
9956 </style>
9957 <script src="https://code.jquery.com/jquery-3.3.1.js"></script>
9958</head>
9959<body>
9960
9961<button>First</button>
9962<button>Second</button>
9963<button>Third</button>
9964
9965<script>
9966$( "button" ).click(function() {
9967 $( this ).replaceWith( "<div>" + $( this ).text() + "</div>" );
9968});
9969</script>
9970
9971</body>
9972</html>
9973```
9974 * @example ​ ````Replace all paragraphs with bold words.
9975```html
9976<!doctype html>
9977<html lang="en">
9978<head>
9979 <meta charset="utf-8">
9980 <title>replaceWith demo</title>
9981 <script src="https://code.jquery.com/jquery-3.3.1.js"></script>
9982</head>
9983<body>
9984
9985<p>Hello</p>
9986<p>cruel</p>
9987<p>World</p>
9988
9989<script>
9990$( "p" ).replaceWith( "<b>Paragraph. </b>" );
9991</script>
9992
9993</body>
9994</html>
9995```
9996 * @example ​ ````On click, replace each paragraph with a div that is already in the DOM and selected with the $() function. Notice it doesn&#39;t clone the object but rather moves it to replace the paragraph.
9997```html
9998<!doctype html>
9999<html lang="en">
10000<head>
10001 <meta charset="utf-8">
10002 <title>replaceWith demo</title>
10003 <style>
10004 div {
10005 border: 2px solid blue;
10006 color: red;
10007 margin: 3px;
10008 }
10009 p {
10010 border: 2px solid red;
10011 color: blue;
10012 margin: 3px;
10013 cursor: pointer;
10014 }
10015 </style>
10016 <script src="https://code.jquery.com/jquery-3.3.1.js"></script>
10017</head>
10018<body>
10019
10020 <p>Hello</p>
10021 <p>cruel</p>
10022 <p>World</p>
10023 <div>Replaced!</div>
10024
10025<script>
10026$( "p" ).click(function() {
10027 $( this ).replaceWith( $( "div" ) );
10028});
10029</script>
10030
10031</body>
10032</html>
10033```
10034 * @example ​ ````On button click, replace the containing div with its child divs and append the class name of the selected element to the paragraph.
10035```html
10036<!doctype html>
10037<html lang="en">
10038<head>
10039 <meta charset="utf-8">
10040 <title>replaceWith demo</title>
10041 <style>
10042 .container {
10043 background-color: #991;
10044 }
10045 .inner {
10046 color: #911;
10047 }
10048 </style>
10049 <script src="https://code.jquery.com/jquery-3.3.1.js"></script>
10050</head>
10051<body>
10052
10053<p>
10054 <button>Replace!</button>
10055</p>
10056<div class="container">
10057 <div class="inner">Scooby</div>
10058 <div class="inner">Dooby</div>
10059 <div class="inner">Doo</div>
10060</div>
10061
10062<script>
10063$( "button" ).on( "click", function() {
10064 var $container = $( "div.container" ).replaceWith(function() {
10065 return $( this ).contents();
10066 });
10067
10068 $( "p" ).append( $container.attr( "class" ) );
10069});
10070</script>
10071
10072</body>
10073</html>
10074```
10075 */
10076 replaceWith(newContent_function: JQuery.htmlString |
10077 JQuery<JQuery.Node> |
10078 JQuery.TypeOrArray<Element> |
10079 JQuery.Node |
10080 ((this: TElement, index: number, oldhtml: JQuery.htmlString) => JQuery.htmlString |
10081 JQuery<JQuery.Node> |
10082 JQuery.TypeOrArray<Element> |
10083 JQuery.Node)): this;
10084 /**
10085 * Bind an event handler to the "resize" JavaScript event, or trigger that event on an element.
10086 * @param eventData An object containing data that will be passed to the event handler.
10087 * @param handler A function to execute each time the event is triggered.
10088 * @see \`{@link https://api.jquery.com/resize/ }\`
10089 * @since 1.4.3
10090 * @deprecated ​ Deprecated since 3.3. Use \`{@link on }\` or \`{@link trigger }\`.
10091 *
10092 * **Cause**: The `.on()` and `.trigger()` methods can set an event handler or generate an event for any event type, and should be used instead of the shortcut methods. This message also applies to the other event shorthands, including: blur, focus, focusin, focusout, resize, scroll, dblclick, mousedown, mouseup, mousemove, mouseover, mouseout, mouseenter, mouseleave, change, select, submit, keydown, keypress, keyup, and contextmenu.
10093 *
10094 * **Solution**: Instead of `.click(fn)` use `.on("click", fn)`. Instead of `.click()` use `.trigger("click")`.
10095 */
10096 resize<TData>(eventData: TData,
10097 handler: JQuery.TypeEventHandler<TElement, TData, TElement, TElement, 'resize'>): this;
10098 /**
10099 * Bind an event handler to the "resize" JavaScript event, or trigger that event on an element.
10100 * @param handler A function to execute each time the event is triggered.
10101 * @see \`{@link https://api.jquery.com/resize/ }\`
10102 * @since 1.0
10103 * @deprecated ​ Deprecated since 3.3. Use \`{@link on }\` or \`{@link trigger }\`.
10104 *
10105 * **Cause**: The `.on()` and `.trigger()` methods can set an event handler or generate an event for any event type, and should be used instead of the shortcut methods. This message also applies to the other event shorthands, including: blur, focus, focusin, focusout, resize, scroll, dblclick, mousedown, mouseup, mousemove, mouseover, mouseout, mouseenter, mouseleave, change, select, submit, keydown, keypress, keyup, and contextmenu.
10106 *
10107 * **Solution**: Instead of `.click(fn)` use `.on("click", fn)`. Instead of `.click()` use `.trigger("click")`.
10108 * @example ​ ````To see the window width while (or after) it is resized, try:
10109```javascript
10110$( window ).resize(function() {
10111 $( "body" ).prepend( "<div>" + $( window ).width() + "</div>" );
10112});
10113```
10114 */
10115 resize(handler?: JQuery.TypeEventHandler<TElement, null, TElement, TElement, 'resize'> |
10116 false): this;
10117 /**
10118 * Bind an event handler to the "scroll" JavaScript event, or trigger that event on an element.
10119 * @param eventData An object containing data that will be passed to the event handler.
10120 * @param handler A function to execute each time the event is triggered.
10121 * @see \`{@link https://api.jquery.com/scroll/ }\`
10122 * @since 1.4.3
10123 * @deprecated ​ Deprecated since 3.3. Use \`{@link on }\` or \`{@link trigger }\`.
10124 *
10125 * **Cause**: The `.on()` and `.trigger()` methods can set an event handler or generate an event for any event type, and should be used instead of the shortcut methods. This message also applies to the other event shorthands, including: blur, focus, focusin, focusout, resize, scroll, dblclick, mousedown, mouseup, mousemove, mouseover, mouseout, mouseenter, mouseleave, change, select, submit, keydown, keypress, keyup, and contextmenu.
10126 *
10127 * **Solution**: Instead of `.click(fn)` use `.on("click", fn)`. Instead of `.click()` use `.trigger("click")`.
10128 */
10129 scroll<TData>(eventData: TData,
10130 handler: JQuery.TypeEventHandler<TElement, TData, TElement, TElement, 'scroll'>): this;
10131 /**
10132 * Bind an event handler to the "scroll" JavaScript event, or trigger that event on an element.
10133 * @param handler A function to execute each time the event is triggered.
10134 * @see \`{@link https://api.jquery.com/scroll/ }\`
10135 * @since 1.0
10136 * @deprecated ​ Deprecated since 3.3. Use \`{@link on }\` or \`{@link trigger }\`.
10137 *
10138 * **Cause**: The `.on()` and `.trigger()` methods can set an event handler or generate an event for any event type, and should be used instead of the shortcut methods. This message also applies to the other event shorthands, including: blur, focus, focusin, focusout, resize, scroll, dblclick, mousedown, mouseup, mousemove, mouseover, mouseout, mouseenter, mouseleave, change, select, submit, keydown, keypress, keyup, and contextmenu.
10139 *
10140 * **Solution**: Instead of `.click(fn)` use `.on("click", fn)`. Instead of `.click()` use `.trigger("click")`.
10141 * @example ​ ````To do something when your page is scrolled:
10142```html
10143<!doctype html>
10144<html lang="en">
10145<head>
10146 <meta charset="utf-8">
10147 <title>scroll demo</title>
10148 <style>
10149 div {
10150 color: blue;
10151 }
10152 p {
10153 color: green;
10154 }
10155 span {
10156 color: red;
10157 display: none;
10158 }
10159 </style>
10160 <script src="https://code.jquery.com/jquery-3.3.1.js"></script>
10161</head>
10162<body>
10163
10164<div>Try scrolling the iframe.</div>
10165<p>Paragraph - <span>Scroll happened!</span></p>
10166
10167<script>
10168$( "p" ).clone().appendTo( document.body );
10169$( "p" ).clone().appendTo( document.body );
10170$( "p" ).clone().appendTo( document.body );
10171$( window ).scroll(function() {
10172 $( "span" ).css( "display", "inline" ).fadeOut( "slow" );
10173});
10174</script>
10175
10176</body>
10177</html>
10178```
10179 */
10180 scroll(handler?: JQuery.TypeEventHandler<TElement, null, TElement, TElement, 'scroll'> |
10181 false): this;
10182 /**
10183 * Set the current horizontal position of the scroll bar for each of the set of matched elements.
10184 * @param value An integer indicating the new position to set the scroll bar to.
10185 * @see \`{@link https://api.jquery.com/scrollLeft/ }\`
10186 * @since 1.2.6
10187 * @example ​ ````Set the scrollLeft of a div.
10188```html
10189<!doctype html>
10190<html lang="en">
10191<head>
10192 <meta charset="utf-8">
10193 <title>scrollLeft demo</title>
10194 <style>
10195 div.demo {
10196 background: #ccc none repeat scroll 0 0;
10197 border: 3px solid #666;
10198 margin: 5px;
10199 padding: 5px;
10200 position: relative;
10201 width: 200px;
10202 height: 100px;
10203 overflow: auto;
10204 }
10205 p {
10206 margin: 10px;
10207 padding: 5px;
10208 border: 2px solid #666;
10209 width: 1000px;
10210 height: 1000px;
10211 }
10212 </style>
10213 <script src="https://code.jquery.com/jquery-3.3.1.js"></script>
10214</head>
10215<body>
10216
10217<div class="demo"><h1>lalala</h1><p>Hello</p></div>
10218
10219<script>
10220$( "div.demo" ).scrollLeft( 300 );
10221</script>
10222
10223</body>
10224</html>
10225```
10226 */
10227 scrollLeft(value: number): this;
10228 /**
10229 * Get the current horizontal position of the scroll bar for the first element in the set of matched elements.
10230 * @see \`{@link https://api.jquery.com/scrollLeft/ }\`
10231 * @since 1.2.6
10232 * @example ​ ````Get the scrollLeft of a paragraph.
10233```html
10234<!doctype html>
10235<html lang="en">
10236<head>
10237 <meta charset="utf-8">
10238 <title>scrollLeft demo</title>
10239 <style>
10240 p {
10241 margin: 10px;
10242 padding: 5px;
10243 border: 2px solid #666;
10244 }
10245 </style>
10246 <script src="https://code.jquery.com/jquery-3.3.1.js"></script>
10247</head>
10248<body>
10249
10250<p>Hello</p><p></p>
10251
10252<script>
10253var p = $( "p:first" );
10254$( "p:last" ).text( "scrollLeft:" + p.scrollLeft() );
10255</script>
10256
10257</body>
10258</html>
10259```
10260 */
10261 scrollLeft(): number | undefined;
10262 /**
10263 * Set the current vertical position of the scroll bar for each of the set of matched elements.
10264 * @param value A number indicating the new position to set the scroll bar to.
10265 * @see \`{@link https://api.jquery.com/scrollTop/ }\`
10266 * @since 1.2.6
10267 * @example ​ ````Set the scrollTop of a div.
10268```html
10269<!doctype html>
10270<html lang="en">
10271<head>
10272 <meta charset="utf-8">
10273 <title>scrollTop demo</title>
10274 <style>
10275 div.demo {
10276 background: #ccc none repeat scroll 0 0;
10277 border: 3px solid #666;
10278 margin: 5px;
10279 padding: 5px;
10280 position: relative;
10281 width: 200px;
10282 height: 100px;
10283 overflow: auto;
10284 }
10285 p {
10286 margin: 10px;
10287 padding: 5px;
10288 border: 2px solid #666;
10289 width: 1000px;
10290 height: 1000px;
10291 }
10292 </style>
10293 <script src="https://code.jquery.com/jquery-3.3.1.js"></script>
10294</head>
10295<body>
10296
10297<div class="demo"><h1>lalala</h1><p>Hello</p></div>
10298
10299<script>
10300$( "div.demo" ).scrollTop( 300 );
10301</script>
10302
10303</body>
10304</html>
10305```
10306 */
10307 scrollTop(value: number): this;
10308 /**
10309 * Get the current vertical position of the scroll bar for the first element in the set of matched elements or set the vertical position of the scroll bar for every matched element.
10310 * @see \`{@link https://api.jquery.com/scrollTop/ }\`
10311 * @since 1.2.6
10312 * @example ​ ````Get the scrollTop of a paragraph.
10313```html
10314<!doctype html>
10315<html lang="en">
10316<head>
10317 <meta charset="utf-8">
10318 <title>scrollTop demo</title>
10319 <style>
10320 p {
10321 margin: 10px;
10322 padding: 5px;
10323 border: 2px solid #666;
10324 }
10325 </style>
10326 <script src="https://code.jquery.com/jquery-3.3.1.js"></script>
10327</head>
10328<body>
10329
10330<p>Hello</p><p></p>
10331
10332<script>
10333var p = $( "p:first" );
10334$( "p:last" ).text( "scrollTop:" + p.scrollTop() );
10335</script>
10336
10337</body>
10338</html>
10339```
10340 */
10341 scrollTop(): number | undefined;
10342 /**
10343 * Bind an event handler to the "select" JavaScript event, or trigger that event on an element.
10344 * @param eventData An object containing data that will be passed to the event handler.
10345 * @param handler A function to execute each time the event is triggered.
10346 * @see \`{@link https://api.jquery.com/select/ }\`
10347 * @since 1.4.3
10348 * @deprecated ​ Deprecated since 3.3. Use \`{@link on }\` or \`{@link trigger }\`.
10349 *
10350 * **Cause**: The `.on()` and `.trigger()` methods can set an event handler or generate an event for any event type, and should be used instead of the shortcut methods. This message also applies to the other event shorthands, including: blur, focus, focusin, focusout, resize, scroll, dblclick, mousedown, mouseup, mousemove, mouseover, mouseout, mouseenter, mouseleave, change, select, submit, keydown, keypress, keyup, and contextmenu.
10351 *
10352 * **Solution**: Instead of `.click(fn)` use `.on("click", fn)`. Instead of `.click()` use `.trigger("click")`.
10353 */
10354 select<TData>(eventData: TData,
10355 handler: JQuery.TypeEventHandler<TElement, TData, TElement, TElement, 'select'>): this;
10356 /**
10357 * Bind an event handler to the "select" JavaScript event, or trigger that event on an element.
10358 * @param handler A function to execute each time the event is triggered.
10359 * @see \`{@link https://api.jquery.com/select/ }\`
10360 * @since 1.0
10361 * @deprecated ​ Deprecated since 3.3. Use \`{@link on }\` or \`{@link trigger }\`.
10362 *
10363 * **Cause**: The `.on()` and `.trigger()` methods can set an event handler or generate an event for any event type, and should be used instead of the shortcut methods. This message also applies to the other event shorthands, including: blur, focus, focusin, focusout, resize, scroll, dblclick, mousedown, mouseup, mousemove, mouseover, mouseout, mouseenter, mouseleave, change, select, submit, keydown, keypress, keyup, and contextmenu.
10364 *
10365 * **Solution**: Instead of `.click(fn)` use `.on("click", fn)`. Instead of `.click()` use `.trigger("click")`.
10366 * @example ​ ````To do something when text in input boxes is selected:
10367```html
10368<!doctype html>
10369<html lang="en">
10370<head>
10371 <meta charset="utf-8">
10372 <title>select demo</title>
10373 <style>
10374 p {
10375 color: blue;
10376 }
10377 div {
10378 color: red;
10379 }
10380 </style>
10381 <script src="https://code.jquery.com/jquery-3.3.1.js"></script>
10382</head>
10383<body>
10384
10385 <p>Click and drag the mouse to select text in the inputs.</p>
10386 <input type="text" value="Some text">
10387 <input type="text" value="to test on">
10388 <div></div>
10389
10390<script>
10391$( ":input" ).select(function() {
10392 $( "div" ).text( "Something was selected" ).show().fadeOut( 1000 );
10393});
10394</script>
10395
10396</body>
10397</html>
10398```
10399 * @example ​ ````To trigger the select event on all input elements, try:
10400```javascript
10401$( "input" ).select();
10402```
10403 */
10404 select(handler?: JQuery.TypeEventHandler<TElement, null, TElement, TElement, 'select'> |
10405 false): this;
10406 /**
10407 * Encode a set of form elements as a string for submission.
10408 * @see \`{@link https://api.jquery.com/serialize/ }\`
10409 * @since 1.0
10410 * @example ​ ````Serialize a form to a query string that could be sent to a server in an Ajax request.
10411```html
10412<!doctype html>
10413<html lang="en">
10414<head>
10415 <meta charset="utf-8">
10416 <title>serialize demo</title>
10417 <style>
10418 body, select {
10419 font-size: 12px;
10420 }
10421 form {
10422 margin: 5px;
10423 }
10424 p {
10425 color: red;
10426 margin: 5px;
10427 font-size: 14px;
10428 }
10429 b {
10430 color: blue;
10431 }
10432 </style>
10433 <script src="https://code.jquery.com/jquery-3.3.1.js"></script>
10434</head>
10435<body>
10436
10437<form>
10438 <select name="single">
10439 <option>Single</option>
10440 <option>Single2</option>
10441 </select>
10442
10443 <br>
10444 <select name="multiple" multiple="multiple">
10445 <option selected="selected">Multiple</option>
10446 <option>Multiple2</option>
10447 <option selected="selected">Multiple3</option>
10448 </select>
10449
10450 <br>
10451 <input type="checkbox" name="check" value="check1" id="ch1">
10452 <label for="ch1">check1</label>
10453 <input type="checkbox" name="check" value="check2" checked="checked" id="ch2">
10454 <label for="ch2">check2</label>
10455
10456 <br>
10457 <input type="radio" name="radio" value="radio1" checked="checked" id="r1">
10458 <label for="r1">radio1</label>
10459 <input type="radio" name="radio" value="radio2" id="r2">
10460 <label for="r2">radio2</label>
10461</form>
10462
10463<p><tt id="results"></tt></p>
10464
10465<script>
10466 function showValues() {
10467 var str = $( "form" ).serialize();
10468 $( "#results" ).text( str );
10469 }
10470 $( "input[type='checkbox'], input[type='radio']" ).on( "click", showValues );
10471 $( "select" ).on( "change", showValues );
10472 showValues();
10473</script>
10474
10475</body>
10476</html>
10477```
10478 */
10479 serialize(): string;
10480 /**
10481 * Encode a set of form elements as an array of names and values.
10482 * @see \`{@link https://api.jquery.com/serializeArray/ }\`
10483 * @since 1.2
10484 * @example ​ ````Get the values from a form, iterate through them, and append them to a results display.
10485```html
10486<!doctype html>
10487<html lang="en">
10488<head>
10489 <meta charset="utf-8">
10490 <title>serializeArray demo</title>
10491 <style>
10492 body, select {
10493 font-size: 14px;
10494 }
10495 form {
10496 margin: 5px;
10497 }
10498 p {
10499 color: red;
10500 margin: 5px;
10501 }
10502 b {
10503 color: blue;
10504 }
10505 </style>
10506 <script src="https://code.jquery.com/jquery-3.3.1.js"></script>
10507</head>
10508<body>
10509
10510<p><b>Results:</b> <span id="results"></span></p>
10511<form>
10512 <select name="single">
10513 <option>Single</option>
10514 <option>Single2</option>
10515 </select>
10516 <select name="multiple" multiple="multiple">
10517 <option selected="selected">Multiple</option>
10518 <option>Multiple2</option>
10519 <option selected="selected">Multiple3</option>
10520 </select>
10521 <br>
10522 <input type="checkbox" name="check" value="check1" id="ch1">
10523 <label for="ch1">check1</label>
10524 <input type="checkbox" name="check" value="check2" checked="checked" id="ch2">
10525 <label for="ch2">check2</label>
10526 <input type="radio" name="radio" value="radio1" checked="checked" id="r1">
10527 <label for="r1">radio1</label>
10528 <input type="radio" name="radio" value="radio2" id="r2">
10529 <label for="r2">radio2</label>
10530</form>
10531
10532<script>
10533 function showValues() {
10534 var fields = $( ":input" ).serializeArray();
10535 $( "#results" ).empty();
10536 jQuery.each( fields, function( i, field ) {
10537 $( "#results" ).append( field.value + " " );
10538 });
10539 }
10540
10541 $( ":checkbox, :radio" ).click( showValues );
10542 $( "select" ).change( showValues );
10543 showValues();
10544</script>
10545
10546</body>
10547</html>
10548```
10549 */
10550 serializeArray(): JQuery.NameValuePair[];
10551 /**
10552 * Display the matched elements.
10553 * @param duration A string or number determining how long the animation will run.
10554 * @param easing A string indicating which easing function to use for the transition.
10555 * @param complete A function to call once the animation is complete, called once per matched element.
10556 * @see \`{@link https://api.jquery.com/show/ }\`
10557 * @since 1.4.3
10558 */
10559 show(duration: JQuery.Duration, easing: string, complete: (this: TElement) => void): this;
10560 /**
10561 * Display the matched elements.
10562 * @param duration A string or number determining how long the animation will run.
10563 * @param easing_complete _&#x40;param_ `easing_complete`
10564 * <br>
10565 * * `easing` — A string indicating which easing function to use for the transition. <br>
10566 * * `complete` — A function to call once the animation is complete, called once per matched element.
10567 * @see \`{@link https://api.jquery.com/show/ }\`
10568 * @since 1.0
10569 * @since 1.4.3
10570 * @example ​ ````Show the first div, followed by each next adjacent sibling div in order, with a 200ms animation. Each animation starts when the previous sibling div&#39;s animation ends.
10571```html
10572<!doctype html>
10573<html lang="en">
10574<head>
10575 <meta charset="utf-8">
10576 <title>show demo</title>
10577 <style>
10578 div {
10579 background: #def3ca;
10580 margin: 3px;
10581 width: 80px;
10582 display: none;
10583 float: left;
10584 text-align: center;
10585 }
10586 </style>
10587 <script src="https://code.jquery.com/jquery-3.3.1.js"></script>
10588</head>
10589<body>
10590
10591<button id="showr">Show</button>
10592<button id="hidr">Hide</button>
10593<div>Hello 3,</div>
10594<div>how</div>
10595<div>are</div>
10596<div>you?</div>
10597
10598<script>
10599$( "#showr" ).click(function() {
10600 $( "div" ).first().show( "fast", function showNext() {
10601 $( this ).next( "div" ).show( "fast", showNext );
10602 });
10603});
10604
10605$( "#hidr" ).click(function() {
10606 $( "div" ).hide( 1000 );
10607});
10608</script>
10609
10610</body>
10611</html>
10612```
10613 * @example ​ ````Show all span and input elements with an animation. Change the text once the animation is done.
10614```html
10615<!doctype html>
10616<html lang="en">
10617<head>
10618 <meta charset="utf-8">
10619 <title>show demo</title>
10620 <style>
10621 span {
10622 display: none;
10623 }
10624 div {
10625 display: none;
10626 }
10627 p {
10628 font-weight: bold;
10629 background-color: #fcd;
10630 }
10631 </style>
10632 <script src="https://code.jquery.com/jquery-3.3.1.js"></script>
10633</head>
10634<body>
10635
10636<button>Do it!</button>
10637<span>Are you sure? (type 'yes' if you are) </span>
10638<div>
10639 <form>
10640 <input type="text" value="as;ldkfjalsdf">
10641 </form>
10642</div>
10643<p style="display:none;">I'm hidden...</p>
10644
10645<script>
10646function doIt() {
10647 $( "span,div" ).show( "slow" );
10648}
10649// Can pass in function name
10650$( "button" ).click( doIt );
10651
10652$( "form" ).submit(function( event ) {
10653 if ( $( "input" ).val() === "yes" ) {
10654 $( "p" ).show( 4000, function() {
10655 $( this ).text( "Ok, DONE! (now showing)" );
10656 });
10657 }
10658 $( "span,div" ).hide( "fast" );
10659
10660 // Prevent form submission
10661 event.preventDefault();
10662});
10663</script>
10664
10665</body>
10666</html>
10667```
10668 */
10669 show(duration: JQuery.Duration, easing_complete: string | ((this: TElement) => void)): this;
10670 /**
10671 * Display the matched elements.
10672 * @param duration_complete_options _&#x40;param_ `duration_complete_options`
10673 * <br>
10674 * * `duration` — A string or number determining how long the animation will run. <br>
10675 * * `complete` — A function to call once the animation is complete, called once per matched element. <br>
10676 * * `options` — A map of additional options to pass to the method.
10677 * @see \`{@link https://api.jquery.com/show/ }\`
10678 * @since 1.0
10679 * @example ​ ````Animates all hidden paragraphs to show slowly, completing the animation within 600 milliseconds.
10680```html
10681<!doctype html>
10682<html lang="en">
10683<head>
10684 <meta charset="utf-8">
10685 <title>show demo</title>
10686 <style>
10687 p {
10688 background: yellow;
10689 }
10690 </style>
10691 <script src="https://code.jquery.com/jquery-3.3.1.js"></script>
10692</head>
10693<body>
10694
10695<button>Show it</button>
10696<p style="display: none">Hello 2</p>
10697
10698<script>
10699$( "button" ).click(function() {
10700 $( "p" ).show( "slow" );
10701});
10702</script>
10703
10704</body>
10705</html>
10706```
10707 */
10708 show(duration_complete_options?: JQuery.Duration | ((this: TElement) => void) | JQuery.EffectsOptions<TElement>): this;
10709 /**
10710 * Get the siblings of each element in the set of matched elements, optionally filtered by a selector.
10711 * @param selector A string containing a selector expression to match elements against.
10712 * @see \`{@link https://api.jquery.com/siblings/ }\`
10713 * @since 1.0
10714 * @example ​ ````Find the unique siblings of all yellow li elements in the 3 lists (including other yellow li elements if appropriate).
10715```html
10716<!doctype html>
10717<html lang="en">
10718<head>
10719 <meta charset="utf-8">
10720 <title>siblings demo</title>
10721 <style>
10722 ul {
10723 float: left;
10724 margin: 5px;
10725 font-size: 16px;
10726 font-weight: bold;
10727 }
10728 p {
10729 color: blue;
10730 margin: 10px 20px;
10731 font-size: 16px;
10732 padding: 5px;
10733 font-weight: bolder;
10734 }
10735 .hilite {
10736 background: yellow;
10737 }
10738 </style>
10739 <script src="https://code.jquery.com/jquery-3.3.1.js"></script>
10740</head>
10741<body>
10742
10743<ul>
10744 <li>One</li>
10745 <li>Two</li>
10746 <li class="hilite">Three</li>
10747 <li>Four</li>
10748</ul>
10749
10750<ul>
10751 <li>Five</li>
10752 <li>Six</li>
10753 <li>Seven</li>
10754</ul>
10755
10756<ul>
10757 <li>Eight</li>
10758 <li class="hilite">Nine</li>
10759 <li>Ten</li>
10760 <li class="hilite">Eleven</li>
10761</ul>
10762
10763<p>Unique siblings: <b></b></p>
10764
10765<script>
10766var len = $( ".hilite" ).siblings()
10767 .css( "color", "red" )
10768 .length;
10769$( "b" ).text( len );
10770</script>
10771
10772</body>
10773</html>
10774```
10775 * @example ​ ````Find all siblings with a class &quot;selected&quot; of each div.
10776```html
10777<!doctype html>
10778<html lang="en">
10779<head>
10780 <meta charset="utf-8">
10781 <title>siblings demo</title>
10782 <script src="https://code.jquery.com/jquery-3.3.1.js"></script>
10783</head>
10784<body>
10785
10786<div><span>Hello</span></div>
10787<p class="selected">Hello Again</p>
10788<p>And Again</p>
10789
10790<script>
10791$( "p" ).siblings( ".selected" ).css( "background", "yellow" );
10792</script>
10793
10794</body>
10795</html>
10796```
10797 */
10798 siblings(selector?: JQuery.Selector): this;
10799 /**
10800 * Reduce the set of matched elements to a subset specified by a range of indices.
10801 * @param start An integer indicating the 0-based position at which the elements begin to be selected. If negative,
10802 * it indicates an offset from the end of the set.
10803 * @param end An integer indicating the 0-based position at which the elements stop being selected. If negative,
10804 * it indicates an offset from the end of the set. If omitted, the range continues until the end of the set.
10805 * @see \`{@link https://api.jquery.com/slice/ }\`
10806 * @since 1.1.4
10807 * @example ​ ````Turns divs yellow based on a random slice.
10808```html
10809<!doctype html>
10810<html lang="en">
10811<head>
10812 <meta charset="utf-8">
10813 <title>slice demo</title>
10814 <style>
10815 div {
10816 width: 40px;
10817 height: 40px;
10818 margin: 10px;
10819 float: left;
10820 border: 2px solid blue;
10821 }
10822 span {
10823 color: red;
10824 font-weight: bold;
10825 }
10826 button {
10827 margin: 5px;
10828 }
10829 </style>
10830 <script src="https://code.jquery.com/jquery-3.3.1.js"></script>
10831</head>
10832<body>
10833
10834<p><button>Turn slice yellow</button>
10835 <span>Click the button!</span></p>
10836 <div></div>
10837 <div></div>
10838 <div></div>
10839 <div></div>
10840 <div></div>
10841 <div></div>
10842 <div></div>
10843 <div></div>
10844 <div></div>
10845
10846<script>
10847function colorEm() {
10848 var $div = $( "div" );
10849 var start = Math.floor( Math.random() * $div.length );
10850 var end = Math.floor( Math.random() * ( $div.length - start ) ) +
10851 start + 1;
10852 if ( end === $div.length ) {
10853 end = undefined;
10854 }
10855 $div.css( "background", "" );
10856 if ( end ) {
10857 $div.slice( start, end ).css( "background", "yellow" );
10858 } else {
10859 $div.slice( start ).css( "background", "yellow" );
10860 }
10861 $( "span" ).text( "$( 'div' ).slice( " + start +
10862 (end ? ", " + end : "") +
10863 ").css( 'background', 'yellow' );" );
10864}
10865
10866$( "button" ).click( colorEm );
10867</script>
10868
10869</body>
10870</html>
10871```
10872 * @example ​ ````Selects all paragraphs, then slices the selection to include only the first element.
10873```javascript
10874$( "p" ).slice( 0, 1 ).wrapInner( "<b></b>" );
10875```
10876 * @example ​ ````Selects all paragraphs, then slices the selection to include only the first and second element.
10877```javascript
10878$( "p" ).slice( 0, 2 ).wrapInner( "<b></b>" );
10879```
10880 * @example ​ ````Selects all paragraphs, then slices the selection to include only the second element.
10881```javascript
10882$( "p" ).slice( 1, 2 ).wrapInner( "<b></b>" );
10883```
10884 * @example ​ ````Selects all paragraphs, then slices the selection to include only the second and third element.
10885```javascript
10886$( "p" ).slice( 1 ).wrapInner( "<b></b>" );
10887```
10888 * @example ​ ````Selects all paragraphs, then slices the selection to include only the third element.
10889```javascript
10890$( "p" ).slice( -1 ).wrapInner( "<b></b>" );
10891```
10892 */
10893 slice(start: number, end?: number): this;
10894 /**
10895 * Display the matched elements with a sliding motion.
10896 * @param duration A string or number determining how long the animation will run.
10897 * @param easing A string indicating which easing function to use for the transition.
10898 * @param complete A function to call once the animation is complete, called once per matched element.
10899 * @see \`{@link https://api.jquery.com/slideDown/ }\`
10900 * @since 1.4.3
10901 */
10902 slideDown(duration: JQuery.Duration, easing: string, complete?: (this: TElement) => void): this;
10903 /**
10904 * Display the matched elements with a sliding motion.
10905 * @param duration_easing _&#x40;param_ `duration_easing`
10906 * <br>
10907 * * `duration` — A string or number determining how long the animation will run. <br>
10908 * * `easing` — A string indicating which easing function to use for the transition.
10909 * @param complete A function to call once the animation is complete, called once per matched element.
10910 * @see \`{@link https://api.jquery.com/slideDown/ }\`
10911 * @since 1.0
10912 * @since 1.4.3
10913 * @example ​ ````Animates all inputs to slide down, completing the animation within 1000 milliseconds. Once the animation is done, the input look is changed especially if it is the middle input which gets the focus.
10914```html
10915<!doctype html>
10916<html lang="en">
10917<head>
10918 <meta charset="utf-8">
10919 <title>slideDown demo</title>
10920 <style>
10921 div {
10922 background: #cfd;
10923 margin: 3px;
10924 width: 50px;
10925 text-align: center;
10926 float: left;
10927 cursor: pointer;
10928 border: 2px outset black;
10929 font-weight: bolder;
10930 }
10931 input {
10932 display: none;
10933 width: 120px;
10934 float: left;
10935 margin: 10px;
10936 }
10937 </style>
10938 <script src="https://code.jquery.com/jquery-3.3.1.js"></script>
10939</head>
10940<body>
10941
10942<div>Push!</div>
10943<input type="text">
10944<input type="text" class="middle">
10945<input type="text">
10946
10947<script>
10948$( "div" ).click(function() {
10949 $( this ).css({
10950 borderStyle: "inset",
10951 cursor: "wait"
10952 });
10953 $( "input" ).slideDown( 1000, function() {
10954 $( this )
10955 .css( "border", "2px red inset" )
10956 .filter( ".middle" )
10957 .css( "background", "yellow" )
10958 .focus();
10959 $( "div" ).css( "visibility", "hidden" );
10960 });
10961});
10962
10963</script>
10964
10965</body>
10966</html>
10967```
10968 */
10969 slideDown(duration_easing: JQuery.Duration | string, complete: (this: TElement) => void): this;
10970 /**
10971 * Display the matched elements with a sliding motion.
10972 * @param duration_easing_complete_options _&#x40;param_ `duration_easing_complete_options`
10973 * <br>
10974 * * `duration` — A string or number determining how long the animation will run. <br>
10975 * * `easing` — A string indicating which easing function to use for the transition. <br>
10976 * * `complete` — A function to call once the animation is complete, called once per matched element. <br>
10977 * * `options` — A map of additional options to pass to the method.
10978 * @see \`{@link https://api.jquery.com/slideDown/ }\`
10979 * @since 1.0
10980 * @since 1.4.3
10981 * @example ​ ````Animates all divs to slide down and show themselves over 600 milliseconds.
10982```html
10983<!doctype html>
10984<html lang="en">
10985<head>
10986 <meta charset="utf-8">
10987 <title>slideDown demo</title>
10988 <style>
10989 div {
10990 background: #de9a44;
10991 margin: 3px;
10992 width: 80px;
10993 height: 40px;
10994 display: none;
10995 float: left;
10996 }
10997 </style>
10998 <script src="https://code.jquery.com/jquery-3.3.1.js"></script>
10999</head>
11000<body>
11001
11002Click me!
11003<div></div>
11004<div></div>
11005<div></div>
11006
11007<script>
11008$( document.body ).click(function () {
11009 if ( $( "div:first" ).is( ":hidden" ) ) {
11010 $( "div" ).slideDown( "slow" );
11011 } else {
11012 $( "div" ).hide();
11013 }
11014});
11015</script>
11016
11017</body>
11018</html>
11019```
11020 */
11021 slideDown(duration_easing_complete_options?: JQuery.Duration | string | ((this: TElement) => void) | JQuery.EffectsOptions<TElement>): this;
11022 /**
11023 * Display or hide the matched elements with a sliding motion.
11024 * @param duration A string or number determining how long the animation will run.
11025 * @param easing A string indicating which easing function to use for the transition.
11026 * @param complete A function to call once the animation is complete, called once per matched element.
11027 * @see \`{@link https://api.jquery.com/slideToggle/ }\`
11028 * @since 1.4.3
11029 */
11030 slideToggle(duration: JQuery.Duration, easing: string, complete?: (this: TElement) => void): this;
11031 /**
11032 * Display or hide the matched elements with a sliding motion.
11033 * @param duration_easing _&#x40;param_ `duration_easing`
11034 * <br>
11035 * * `duration` — A string or number determining how long the animation will run. <br>
11036 * * `easing` — A string indicating which easing function to use for the transition.
11037 * @param complete A function to call once the animation is complete, called once per matched element.
11038 * @see \`{@link https://api.jquery.com/slideToggle/ }\`
11039 * @since 1.0
11040 * @since 1.4.3
11041 * @example ​ ````Animates divs between dividers with a toggle that makes some appear and some disappear.
11042```html
11043<!doctype html>
11044<html lang="en">
11045<head>
11046 <meta charset="utf-8">
11047 <title>slideToggle demo</title>
11048 <style>
11049 div {
11050 background: #b977d1;
11051 margin: 3px;
11052 width: 60px;
11053 height: 60px;
11054 float: left;
11055 }
11056 div.still {
11057 background: #345;
11058 width: 5px;
11059 }
11060 div.hider {
11061 display: none;
11062 }
11063 span {
11064 color: red;
11065 }
11066 p {
11067 clear: left;
11068 }
11069 </style>
11070 <script src="https://code.jquery.com/jquery-3.3.1.js"></script>
11071</head>
11072<body>
11073
11074<div></div>
11075<div class="still"></div>
11076<div style="display:none;">
11077</div><div class="still"></div>
11078<div></div>
11079<div class="still"></div>
11080<div class="hider"></div>
11081<div class="still"></div>
11082<div class="hider"></div>
11083<div class="still"></div>
11084<div></div>
11085<p><button id="aa">Toggle</button> There have been <span>0</span> toggled divs.</p>
11086
11087<script>
11088$( "#aa" ).click(function() {
11089 $( "div:not(.still)" ).slideToggle( "slow", function() {
11090 var n = parseInt( $( "span" ).text(), 10 );
11091 $( "span" ).text( n + 1 );
11092 });
11093});
11094</script>
11095
11096</body>
11097</html>
11098```
11099 */
11100 slideToggle(duration_easing: JQuery.Duration | string, complete: (this: TElement) => void): this;
11101 /**
11102 * Display or hide the matched elements with a sliding motion.
11103 * @param duration_easing_complete_options _&#x40;param_ `duration_easing_complete_options`
11104 * <br>
11105 * * `duration` — A string or number determining how long the animation will run. <br>
11106 * * `easing` — A string indicating which easing function to use for the transition. <br>
11107 * * `complete` — A function to call once the animation is complete, called once per matched element. <br>
11108 * * `options` — A map of additional options to pass to the method.
11109 * @see \`{@link https://api.jquery.com/slideToggle/ }\`
11110 * @since 1.0
11111 * @since 1.4.3
11112 * @example ​ ````Animates all paragraphs to slide up or down, completing the animation within 600 milliseconds.
11113```html
11114<!doctype html>
11115<html lang="en">
11116<head>
11117 <meta charset="utf-8">
11118 <title>slideToggle demo</title>
11119 <style>
11120 p {
11121 width: 400px;
11122 }
11123 </style>
11124 <script src="https://code.jquery.com/jquery-3.3.1.js"></script>
11125</head>
11126<body>
11127
11128<button>Toggle</button>
11129<p>
11130 This is the paragraph to end all paragraphs. You
11131 should feel <em>lucky</em> to have seen such a paragraph in
11132 your life. Congratulations!
11133</p>
11134
11135<script>
11136$( "button" ).click(function() {
11137 $( "p" ).slideToggle( "slow" );
11138});
11139</script>
11140
11141</body>
11142</html>
11143```
11144 */
11145 slideToggle(duration_easing_complete_options?: JQuery.Duration | string | ((this: TElement) => void) | JQuery.EffectsOptions<TElement>): this;
11146 /**
11147 * Hide the matched elements with a sliding motion.
11148 * @param duration A string or number determining how long the animation will run.
11149 * @param easing A string indicating which easing function to use for the transition.
11150 * @param complete A function to call once the animation is complete, called once per matched element.
11151 * @see \`{@link https://api.jquery.com/slideUp/ }\`
11152 * @since 1.4.3
11153 */
11154 slideUp(duration: JQuery.Duration, easing: string, complete?: (this: TElement) => void): this;
11155 /**
11156 * Hide the matched elements with a sliding motion.
11157 * @param duration_easing _&#x40;param_ `duration_easing`
11158 * <br>
11159 * * `duration` — A string or number determining how long the animation will run. <br>
11160 * * `easing` — A string indicating which easing function to use for the transition.
11161 * @param complete A function to call once the animation is complete, called once per matched element.
11162 * @see \`{@link https://api.jquery.com/slideUp/ }\`
11163 * @since 1.0
11164 * @since 1.4.3
11165 * @example ​ ````Animates the parent paragraph to slide up, completing the animation within 200 milliseconds. Once the animation is done, it displays an alert.
11166```html
11167<!doctype html>
11168<html lang="en">
11169<head>
11170 <meta charset="utf-8">
11171 <title>slideUp demo</title>
11172 <style>
11173 div {
11174 margin: 2px;
11175 }
11176 </style>
11177 <script src="https://code.jquery.com/jquery-3.3.1.js"></script>
11178</head>
11179<body>
11180
11181<div>
11182 <button>Hide One</button>
11183 <input type="text" value="One">
11184</div>
11185
11186<div>
11187 <button>Hide Two</button>
11188 <input type="text" value="Two">
11189</div>
11190
11191<div>
11192 <button>Hide Three</button>
11193 <input type="text" value="Three">
11194</div>
11195
11196<div id="msg"></div>
11197
11198<script>
11199$( "button" ).click(function() {
11200 $( this ).parent().slideUp( "slow", function() {
11201 $( "#msg" ).text( $( "button", this ).text() + " has completed." );
11202 });
11203});
11204</script>
11205
11206</body>
11207</html>
11208```
11209 */
11210 slideUp(duration_easing: JQuery.Duration | string, complete: (this: TElement) => void): this;
11211 /**
11212 * Hide the matched elements with a sliding motion.
11213 * @param duration_easing_complete_options _&#x40;param_ `duration_easing_complete_options`
11214 * <br>
11215 * * `duration` — A string or number determining how long the animation will run. <br>
11216 * * `easing` — A string indicating which easing function to use for the transition. <br>
11217 * * `complete` — A function to call once the animation is complete, called once per matched element. <br>
11218 * * `options` — A map of additional options to pass to the method.
11219 * @see \`{@link https://api.jquery.com/slideUp/ }\`
11220 * @since 1.0
11221 * @since 1.4.3
11222 * @example ​ ````Animates all divs to slide up, completing the animation within 400 milliseconds.
11223```html
11224<!doctype html>
11225<html lang="en">
11226<head>
11227 <meta charset="utf-8">
11228 <title>slideUp demo</title>
11229 <style>
11230 div {
11231 background: #3d9a44;
11232 margin: 3px;
11233 width: 80px;
11234 height: 40px;
11235 float: left;
11236 }
11237 </style>
11238 <script src="https://code.jquery.com/jquery-3.3.1.js"></script>
11239</head>
11240<body>
11241
11242Click me!
11243<div></div>
11244<div></div>
11245<div></div>
11246<div></div>
11247<div></div>
11248
11249<script>
11250$( document.body ).click(function() {
11251 if ( $( "div:first" ).is( ":hidden" ) ) {
11252 $( "div" ).show( "slow" );
11253 } else {
11254 $( "div" ).slideUp();
11255 }
11256});
11257</script>
11258
11259</body>
11260</html>
11261```
11262 */
11263 slideUp(duration_easing_complete_options?: JQuery.Duration | string | ((this: TElement) => void) | JQuery.EffectsOptions<TElement>): this;
11264 /**
11265 * Stop the currently-running animation on the matched elements.
11266 * @param queue The name of the queue in which to stop animations.
11267 * @param clearQueue A Boolean indicating whether to remove queued animation as well. Defaults to false.
11268 * @param jumpToEnd A Boolean indicating whether to complete the current animation immediately. Defaults to false.
11269 * @see \`{@link https://api.jquery.com/stop/ }\`
11270 * @since 1.7
11271 */
11272 stop(queue: string, clearQueue?: boolean, jumpToEnd?: boolean): this;
11273 /**
11274 * Stop the currently-running animation on the matched elements.
11275 * @param clearQueue A Boolean indicating whether to remove queued animation as well. Defaults to false.
11276 * @param jumpToEnd A Boolean indicating whether to complete the current animation immediately. Defaults to false.
11277 * @see \`{@link https://api.jquery.com/stop/ }\`
11278 * @since 1.2
11279 * @example ​ ````Click the Go button once to start the animation, then click the STOP button to stop it where it&#39;s currently positioned. Another option is to click several buttons to queue them up and see that stop just kills the currently playing one.
11280```html
11281<!doctype html>
11282<html lang="en">
11283<head>
11284 <meta charset="utf-8">
11285 <title>stop demo</title>
11286 <style>
11287 div {
11288 position: absolute;
11289 background-color: #abc;
11290 left: 0px;
11291 top: 30px;
11292 width: 60px;
11293 height: 60px;
11294 margin: 5px;
11295 }
11296 </style>
11297 <script src="https://code.jquery.com/jquery-3.3.1.js"></script>
11298</head>
11299<body>
11300
11301<button id="go">Go</button>
11302<button id="stop">STOP!</button>
11303<button id="back">Back</button>
11304<div class="block"></div>
11305
11306<script>
11307// Start animation
11308$( "#go" ).click(function() {
11309 $( ".block" ).animate({ left: "+=100px" }, 2000 );
11310});
11311
11312// Stop animation when button is clicked
11313$( "#stop" ).click(function() {
11314 $( ".block" ).stop();
11315});
11316
11317// Start animation in the opposite direction
11318$( "#back" ).click(function() {
11319 $( ".block" ).animate({ left: "-=100px" }, 2000 );
11320});
11321</script>
11322
11323</body>
11324</html>
11325```
11326 * @example ​ ````Click the slideToggle button to start the animation, then click again before the animation is completed. The animation will toggle the other direction from the saved starting point.
11327```html
11328<!doctype html>
11329<html lang="en">
11330<head>
11331 <meta charset="utf-8">
11332 <title>stop demo</title>
11333 <style>
11334 .block {
11335 background-color: #abc;
11336 border: 2px solid black;
11337 width: 200px;
11338 height: 80px;
11339 margin: 10px;
11340 }
11341 </style>
11342 <script src="https://code.jquery.com/jquery-3.3.1.js"></script>
11343</head>
11344<body>
11345
11346<button id="toggle">slideToggle</button>
11347<div class="block"></div>
11348
11349<script>
11350var $block = $( ".block" );
11351
11352// Toggle a sliding animation animation
11353$( "#toggle" ).on( "click", function() {
11354 $block.stop().slideToggle( 1000 );
11355});
11356</script>
11357
11358</body>
11359</html>
11360```
11361 */
11362 stop(clearQueue?: boolean, jumpToEnd?: boolean): this;
11363 /**
11364 * Bind an event handler to the "submit" JavaScript event, or trigger that event on an element.
11365 * @param eventData An object containing data that will be passed to the event handler.
11366 * @param handler A function to execute each time the event is triggered.
11367 * @see \`{@link https://api.jquery.com/submit/ }\`
11368 * @since 1.4.3
11369 * @deprecated ​ Deprecated since 3.3. Use \`{@link on }\` or \`{@link trigger }\`.
11370 *
11371 * **Cause**: The `.on()` and `.trigger()` methods can set an event handler or generate an event for any event type, and should be used instead of the shortcut methods. This message also applies to the other event shorthands, including: blur, focus, focusin, focusout, resize, scroll, dblclick, mousedown, mouseup, mousemove, mouseover, mouseout, mouseenter, mouseleave, change, select, submit, keydown, keypress, keyup, and contextmenu.
11372 *
11373 * **Solution**: Instead of `.click(fn)` use `.on("click", fn)`. Instead of `.click()` use `.trigger("click")`.
11374 */
11375 submit<TData>(eventData: TData,
11376 handler: JQuery.TypeEventHandler<TElement, TData, TElement, TElement, 'submit'>): this;
11377 /**
11378 * Bind an event handler to the "submit" JavaScript event, or trigger that event on an element.
11379 * @param handler A function to execute each time the event is triggered.
11380 * @see \`{@link https://api.jquery.com/submit/ }\`
11381 * @since 1.0
11382 * @deprecated ​ Deprecated since 3.3. Use \`{@link on }\` or \`{@link trigger }\`.
11383 *
11384 * **Cause**: The `.on()` and `.trigger()` methods can set an event handler or generate an event for any event type, and should be used instead of the shortcut methods. This message also applies to the other event shorthands, including: blur, focus, focusin, focusout, resize, scroll, dblclick, mousedown, mouseup, mousemove, mouseover, mouseout, mouseenter, mouseleave, change, select, submit, keydown, keypress, keyup, and contextmenu.
11385 *
11386 * **Solution**: Instead of `.click(fn)` use `.on("click", fn)`. Instead of `.click()` use `.trigger("click")`.
11387 * @example ​ ````If you&#39;d like to prevent forms from being submitted unless a flag variable is set, try:
11388```html
11389<!doctype html>
11390<html lang="en">
11391<head>
11392 <meta charset="utf-8">
11393 <title>submit demo</title>
11394 <style>
11395 p {
11396 margin: 0;
11397 color: blue;
11398 }
11399 div,p {
11400 margin-left: 10px;
11401 }
11402 span {
11403 color: red;
11404 }
11405 </style>
11406 <script src="https://code.jquery.com/jquery-3.3.1.js"></script>
11407</head>
11408<body>
11409
11410<p>Type 'correct' to validate.</p>
11411<form action="javascript:alert( 'success!' );">
11412 <div>
11413 <input type="text">
11414 <input type="submit">
11415 </div>
11416</form>
11417<span></span>
11418
11419<script>
11420$( "form" ).submit(function( event ) {
11421 if ( $( "input:first" ).val() === "correct" ) {
11422 $( "span" ).text( "Validated..." ).show();
11423 return;
11424 }
11425
11426 $( "span" ).text( "Not valid!" ).show().fadeOut( 1000 );
11427 event.preventDefault();
11428});
11429</script>
11430
11431</body>
11432</html>
11433```
11434 * @example ​ ````If you&#39;d like to prevent forms from being submitted unless a flag variable is set, try:
11435```javascript
11436$( "form" ).submit(function() {
11437 return this.some_flag_variable;
11438});
11439```
11440 * @example ​ ````To trigger the submit event on the first form on the page, try:
11441```javascript
11442$( "form:first" ).submit();
11443```
11444 */
11445 submit(handler?: JQuery.TypeEventHandler<TElement, null, TElement, TElement, 'submit'> |
11446 false): this;
11447 /**
11448 * Set the content of each element in the set of matched elements to the specified text.
11449 * @param text_function _&#x40;param_ `text_function`
11450 * <br>
11451 * * `text` — The text to set as the content of each matched element. When Number or Boolean is supplied, it will
11452 * be converted to a String representation. <br>
11453 * * `function` — A function returning the text content to set. Receives the index position of the element in the set
11454 * and the old text value as arguments.
11455 * @see \`{@link https://api.jquery.com/text/ }\`
11456 * @since 1.0
11457 * @since 1.4
11458 * @example ​ ````Add text to the paragraph (notice the bold tag is escaped).
11459```html
11460<!doctype html>
11461<html lang="en">
11462<head>
11463 <meta charset="utf-8">
11464 <title>text demo</title>
11465 <style>
11466 p {
11467 color: blue;
11468 margin: 8px;
11469 }
11470 </style>
11471 <script src="https://code.jquery.com/jquery-3.3.1.js"></script>
11472</head>
11473<body>
11474
11475<p>Test Paragraph.</p>
11476
11477<script>
11478$( "p" ).text( "<b>Some</b> new text." );
11479</script>
11480
11481</body>
11482</html>
11483```
11484 */
11485 text(text_function: string | number | boolean | ((this: TElement, index: number, text: string) => string | number | boolean)): this;
11486 /**
11487 * Get the combined text contents of each element in the set of matched elements, including their descendants.
11488 * @see \`{@link https://api.jquery.com/text/ }\`
11489 * @since 1.0
11490 * @example ​ ````Find the text in the first paragraph (stripping out the html), then set the html of the last paragraph to show it is just text (the red bold is gone).
11491```html
11492<!doctype html>
11493<html lang="en">
11494<head>
11495 <meta charset="utf-8">
11496 <title>text demo</title>
11497 <style>
11498 p {
11499 color: blue;
11500 margin: 8px;
11501 }
11502 b {
11503 color: red;
11504 }
11505 </style>
11506 <script src="https://code.jquery.com/jquery-3.3.1.js"></script>
11507</head>
11508<body>
11509
11510<p><b>Test</b> Paragraph.</p>
11511<p></p>
11512
11513<script>
11514var str = $( "p:first" ).text();
11515$( "p:last" ).html( str );
11516</script>
11517
11518</body>
11519</html>
11520```
11521 */
11522 text(): string;
11523 /**
11524 * Retrieve all the elements contained in the jQuery set, as an array.
11525 * @see \`{@link https://api.jquery.com/toArray/ }\`
11526 * @since 1.4
11527 * @example ​ ````Select all divs in the document and return the DOM Elements as an Array; then use the built-in reverse() method to reverse that array.
11528```html
11529<!doctype html>
11530<html lang="en">
11531<head>
11532 <meta charset="utf-8">
11533 <title>toArray demo</title>
11534 <style>
11535 span {
11536 color: red;
11537 }
11538 </style>
11539 <script src="https://code.jquery.com/jquery-3.3.1.js"></script>
11540</head>
11541<body>
11542
11543Reversed - <span></span>
11544
11545<div>One</div>
11546<div>Two</div>
11547<div>Three</div>​
11548<script>
11549function disp( divs ) {
11550 var a = [];
11551 for ( var i = 0; i < divs.length; i++ ) {
11552 a.push( divs[ i ].innerHTML );
11553 }
11554 $( "span" ).text( a.join( " " ) );
11555}
11556
11557disp( $( "div" ).toArray().reverse() );
11558</script>
11559
11560</body>
11561</html>
11562```
11563 */
11564 toArray(): TElement[];
11565 /**
11566 * Display or hide the matched elements.
11567 * @param duration A string or number determining how long the animation will run.
11568 * @param easing A string indicating which easing function to use for the transition.
11569 * @param complete A function to call once the animation is complete, called once per matched element.
11570 * @see \`{@link https://api.jquery.com/toggle/ }\`
11571 * @since 1.4.3
11572 */
11573 toggle(duration: JQuery.Duration, easing: string, complete?: (this: TElement) => void): this;
11574 /**
11575 * Display or hide the matched elements.
11576 * @param duration A string or number determining how long the animation will run.
11577 * @param complete A function to call once the animation is complete, called once per matched element.
11578 * @see \`{@link https://api.jquery.com/toggle/ }\`
11579 * @since 1.0
11580 */
11581 toggle(duration: JQuery.Duration, complete: (this: TElement) => void): this;
11582 /**
11583 * Display or hide the matched elements.
11584 * @param duration_complete_options_display _&#x40;param_ `duration_complete_options_display`
11585 * <br>
11586 * * `duration` — A string or number determining how long the animation will run. <br>
11587 * * `complete` — A function to call once the animation is complete, called once per matched element. <br>
11588 * * `options` — A map of additional options to pass to the method. <br>
11589 * * `display` — Use true to show the element or false to hide it.
11590 * @see \`{@link https://api.jquery.com/toggle/ }\`
11591 * @since 1.0
11592 * @since 1.3
11593 * @example ​ ````Toggles all paragraphs.
11594```html
11595<!doctype html>
11596<html lang="en">
11597<head>
11598 <meta charset="utf-8">
11599 <title>toggle demo</title>
11600 <script src="https://code.jquery.com/jquery-3.3.1.js"></script>
11601</head>
11602<body>
11603
11604<button>Toggle</button>
11605<p>Hello</p>
11606<p style="display: none">Good Bye</p>
11607
11608<script>
11609$( "button" ).click(function() {
11610 $( "p" ).toggle();
11611});
11612</script>
11613
11614</body>
11615</html>
11616```
11617 * @example ​ ````Animates all paragraphs to be shown if they are hidden and hidden if they are visible, completing the animation within 600 milliseconds.
11618```html
11619<!doctype html>
11620<html lang="en">
11621<head>
11622 <meta charset="utf-8">
11623 <title>toggle demo</title>
11624 <style>
11625 p {
11626 background: #dad;
11627 font-weight: bold;
11628 font-size: 16px;
11629 }
11630 </style>
11631 <script src="https://code.jquery.com/jquery-3.3.1.js"></script>
11632</head>
11633<body>
11634
11635<button>Toggle 'em</button>
11636<p>Hiya</p>
11637<p>Such interesting text, eh?</p>
11638
11639<script>
11640$( "button" ).click(function() {
11641 $( "p" ).toggle( "slow" );
11642});
11643</script>
11644
11645</body>
11646</html>
11647```
11648 * @example ​ ````Shows all paragraphs, then hides them all, back and forth.
11649```html
11650<!doctype html>
11651<html lang="en">
11652<head>
11653 <meta charset="utf-8">
11654 <title>toggle demo</title>
11655 <script src="https://code.jquery.com/jquery-3.3.1.js"></script>
11656</head>
11657<body>
11658
11659<button>Toggle</button>
11660<p>Hello</p>
11661<p style="display: none">Good Bye</p>
11662
11663<script>
11664var flip = 0;
11665$( "button" ).click(function() {
11666 $( "p" ).toggle( flip++ % 2 === 0 );
11667});
11668</script>
11669
11670</body>
11671</html>
11672```
11673 */
11674 toggle(duration_complete_options_display?: JQuery.Duration | ((this: TElement) => void) | JQuery.EffectsOptions<TElement> | boolean): this;
11675 /**
11676 * Add or remove one or more classes from each element in the set of matched elements, depending on either the class's presence or the value of the state argument.
11677 * @param className_function _&#x40;param_ `className_function`
11678 * <br>
11679 * * `className` — One or more class names (separated by spaces) to be toggled for each element in the matched set. <br>
11680 * * `function` — A function that returns class names to be toggled in the class attribute of each element in the
11681 * matched set. Receives the index position of the element in the set, the old class value, and the state as arguments.
11682 * @param state A Boolean (not just truthy/falsy) value to determine whether the class should be added or removed.
11683 * @see \`{@link https://api.jquery.com/toggleClass/ }\`
11684 * @since 1.0
11685 * @since 1.3
11686 * @since 1.4
11687 * @since 3.3
11688 * @example ​ ````Toggle the class &#39;highlight&#39; when a paragraph is clicked.
11689```html
11690<!doctype html>
11691<html lang="en">
11692<head>
11693 <meta charset="utf-8">
11694 <title>toggleClass demo</title>
11695 <style>
11696 p {
11697 margin: 4px;
11698 font-size: 16px;
11699 font-weight: bolder;
11700 cursor: pointer;
11701 }
11702 .blue {
11703 color: blue;
11704 }
11705 .highlight {
11706 background: yellow;
11707 }
11708 </style>
11709 <script src="https://code.jquery.com/jquery-3.3.1.js"></script>
11710</head>
11711<body>
11712
11713<p class="blue">Click to toggle</p>
11714<p class="blue highlight">highlight</p>
11715<p class="blue">on these</p>
11716<p class="blue">paragraphs</p>
11717
11718<script>
11719$( "p" ).click(function() {
11720 $( this ).toggleClass( "highlight" );
11721});
11722</script>
11723
11724</body>
11725</html>
11726```
11727 * @example ​ ````Add the &quot;highlight&quot; class to the clicked paragraph on every third click of that paragraph, remove it every first and second click.
11728```html
11729<!doctype html>
11730<html lang="en">
11731<head>
11732 <meta charset="utf-8">
11733 <title>toggleClass demo</title>
11734 <style>
11735 p {
11736 margin: 4px;
11737 font-size: 16px;
11738 font-weight: bolder;
11739 cursor: pointer;
11740 }
11741 .blue {
11742 color: blue;
11743 }
11744 .highlight {
11745 background: red;
11746 }
11747 </style>
11748 <script src="https://code.jquery.com/jquery-3.3.1.js"></script>
11749</head>
11750<body>
11751
11752<p class="blue">Click to toggle (<span>clicks: 0</span>)</p>
11753<p class="blue highlight">highlight (<span>clicks: 0</span>)</p>
11754<p class="blue">on these (<span>clicks: 0</span>)</p>
11755<p class="blue">paragraphs (<span>clicks: 0</span>)</p>
11756
11757<script>
11758var count = 0;
11759$( "p" ).each(function() {
11760 var $thisParagraph = $( this );
11761 var count = 0;
11762 $thisParagraph.click(function() {
11763 count++;
11764 $thisParagraph.find( "span" ).text( "clicks: " + count );
11765 $thisParagraph.toggleClass( "highlight", count % 3 === 0 );
11766 });
11767});
11768</script>
11769
11770</body>
11771</html>
11772```
11773 * @example ​ ````Toggle the class name(s) indicated on the buttons for each div.
11774```html
11775<!doctype html>
11776<html lang="en">
11777<head>
11778 <meta charset="utf-8">
11779 <title>toggleClass demo</title>
11780 <style>
11781 .wrap > div {
11782 float: left;
11783 width: 100px;
11784 margin: 1em 1em 0 0;
11785 padding-left: 3px;
11786 border: 1px solid #abc;
11787 }
11788 div.a {
11789 background-color: aqua;
11790 }
11791 div.b {
11792 background-color: burlywood;
11793 }
11794 div.c {
11795 background-color: cornsilk;
11796 }
11797 </style>
11798 <script src="https://code.jquery.com/jquery-3.3.1.js"></script>
11799</head>
11800<body>
11801
11802<div class="buttons">
11803 <button>toggle</button>
11804 <button class="a">toggle a</button>
11805 <button class="a b">toggle a b</button>
11806 <button class="a b c">toggle a b c</button>
11807 <a href="#">reset</a>
11808</div>
11809<div class="wrap">
11810 <div></div>
11811 <div class="b"></div>
11812 <div class="a b"></div>
11813 <div class="a c"></div>
11814</div>
11815
11816<script>
11817var cls = [ "", "a", "a b", "a b c" ];
11818var divs = $( "div.wrap" ).children();
11819var appendClass = function() {
11820 divs.append(function() {
11821 return "<div>" + ( this.className || "none" ) + "</div>";
11822 });
11823};
11824
11825appendClass();
11826
11827$( "button" ).on( "click", function() {
11828 var tc = this.className || undefined;
11829 divs.toggleClass( tc );
11830 appendClass();
11831});
11832
11833$( "a" ).on( "click", function( event ) {
11834 event.preventDefault();
11835 divs.empty().each(function( i ) {
11836 this.className = cls[ i ];
11837 });
11838 appendClass();
11839});
11840</script>
11841
11842</body>
11843</html>
11844```
11845 */
11846 toggleClass<TState extends boolean>(className_function: JQuery.TypeOrArray<string> | ((this: TElement, index: number, className: string, state: TState) => string),
11847 state?: TState): this;
11848 /**
11849 * Add or remove one or more classes from each element in the set of matched elements, depending on either the class's presence or the value of the state argument.
11850 * @param state A boolean value to determine whether the class should be added or removed.
11851 * @see \`{@link https://api.jquery.com/toggleClass/ }\`
11852 * @since 1.4
11853 * @deprecated ​ Deprecated since 3.0. See \`{@link https://github.com/jquery/jquery/pull/2618 }\`.
11854 *
11855 * **Cause**: Calling `.toggleClass()` with no arguments, or with a single Boolean `true` or `false` argument, has been deprecated. Its behavior was poorly documented, but essentially the method saved away the current class value in a data item when the class was removed and restored the saved value when it was toggled back. If you do not believe you are specificially trying to use this form of the method, it is possible you are accidentally doing so via an inadvertent undefined value, as `.toggleClass( undefined )` toggles all classes.
11856 *
11857 * **Solution**: If this functionality is still needed, save the current full `.attr( "class" )` value in a data item and restore it when required.
11858 */
11859 toggleClass(state?: boolean): this;
11860 /**
11861 * Execute all handlers and behaviors attached to the matched elements for the given event type.
11862 * @param eventType_event _&#x40;param_ `eventType_event`
11863 * <br>
11864 * * `eventType` — A string containing a JavaScript event type, such as `click` or `submit`. <br>
11865 * * `event` — A \`{@link https://api.jquery.com/category/events/event-object/ jQuery.Event}\` object.
11866 * @param extraParameters Additional parameters to pass along to the event handler.
11867 * @see \`{@link https://api.jquery.com/trigger/ }\`
11868 * @since 1.0
11869 * @since 1.3
11870 * @example ​ ````Clicks to button #2 also trigger a click for button #1.
11871```html
11872<!doctype html>
11873<html lang="en">
11874<head>
11875 <meta charset="utf-8">
11876 <title>trigger demo</title>
11877 <style>
11878 button {
11879 margin: 10px;
11880 }
11881 div {
11882 color: blue;
11883 font-weight: bold;
11884 }
11885 span {
11886 color: red;
11887 }
11888 </style>
11889 <script src="https://code.jquery.com/jquery-3.3.1.js"></script>
11890</head>
11891<body>
11892
11893<button>Button #1</button>
11894<button>Button #2</button>
11895<div><span>0</span> button #1 clicks.</div>
11896<div><span>0</span> button #2 clicks.</div>
11897
11898<script>
11899$( "button:first" ).click(function() {
11900 update( $( "span:first" ) );
11901});
11902
11903$( "button:last" ).click(function() {
11904 $( "button:first" ).trigger( "click" );
11905 update( $( "span:last" ) );
11906});
11907
11908function update( j ) {
11909 var n = parseInt( j.text(), 10 );
11910 j.text( n + 1 );
11911}
11912</script>
11913
11914</body>
11915</html>
11916```
11917 * @example ​ ````To submit the first form without using the submit() function, try:
11918```javascript
11919$( "form:first" ).trigger( "submit" );
11920```
11921 * @example ​ ````To submit the first form without using the submit() function, try:
11922```javascript
11923var event = jQuery.Event( "submit" );
11924$( "form:first" ).trigger( event );
11925if ( event.isDefaultPrevented() ) {
11926 // Perform an action...
11927}
11928```
11929 * @example ​ ````To pass arbitrary data to an event:
11930```javascript
11931$( "p" )
11932 .click(function( event, a, b ) {
11933 // When a normal click fires, a and b are undefined
11934 // for a trigger like below a refers to "foo" and b refers to "bar"
11935 })
11936 .trigger( "click", [ "foo", "bar" ] );
11937```
11938 * @example ​ ````To pass arbitrary data through an event object:
11939```javascript
11940var event = jQuery.Event( "logged" );
11941event.user = "foo";
11942event.pass = "bar";
11943$( "body" ).trigger( event );
11944```
11945 * @example ​ ````Alternative way to pass data through an event object:
11946```javascript
11947$( "body" ).trigger({
11948 type:"logged",
11949 user:"foo",
11950 pass:"bar"
11951});
11952```
11953 */
11954 trigger(eventType_event: string | JQuery.Event, extraParameters?: any[] | JQuery.PlainObject | string | number | boolean): this;
11955 /**
11956 * Execute all handlers attached to an element for an event.
11957 * @param eventType_event _&#x40;param_ `eventType_event`
11958 * <br>
11959 * * `eventType` — A string containing a JavaScript event type, such as `click` or `submit`. <br>
11960 * * `event` — A \`{@link https://api.jquery.com/category/events/event-object/ jQuery.Event}\` object.
11961 * @param extraParameters Additional parameters to pass along to the event handler.
11962 * @see \`{@link https://api.jquery.com/triggerHandler/ }\`
11963 * @since 1.2
11964 * @since 1.3
11965 * @example ​ ````If you called .triggerHandler() on a focus event - the browser&#39;s default focus action would not be triggered, only the event handlers bound to the focus event.
11966```html
11967<!doctype html>
11968<html lang="en">
11969<head>
11970 <meta charset="utf-8">
11971 <title>triggerHandler demo</title>
11972 <script src="https://code.jquery.com/jquery-3.3.1.js"></script>
11973</head>
11974<body>
11975
11976<button id="old">.trigger( "focus" )</button>
11977<button id="new">.triggerHandler( "focus" )</button><br><br>
11978
11979<input type="text" value="To Be Focused">
11980
11981<script>
11982$( "#old" ).click(function() {
11983 $( "input" ).trigger( "focus" );
11984});
11985$( "#new" ).click(function() {
11986 $( "input" ).triggerHandler( "focus" );
11987});
11988$( "input" ).focus(function() {
11989 $( "<span>Focused!</span>" ).appendTo( "body" ).fadeOut( 1000 );
11990});
11991</script>
11992
11993</body>
11994</html>
11995```
11996 */
11997 triggerHandler(eventType_event: string | JQuery.Event, extraParameters?: any[] | JQuery.PlainObject | string | number | boolean): any;
11998 /**
11999 * Remove a previously-attached event handler from the elements.
12000 * @param event A string containing one or more DOM event types, such as "click" or "submit," or custom event names.
12001 * @param handler A function to execute each time the event is triggered.
12002 * @see \`{@link https://api.jquery.com/unbind/ }\`
12003 * @since 1.0
12004 * @since 1.4.3
12005 * @deprecated ​ Deprecated since 3.0. Use \`{@link off }\`.
12006 *
12007 * **Cause**: These event binding methods have been deprecated in favor of the `.on()` and `.off()` methods which can handle both delegated and direct event binding. Although the older methods are still present in jQuery 3.0, they may be removed as early as the next major-version update.
12008 *
12009 * **Solution**: Change the method call to use `.on()` or `.off()`, the documentation for the old methods include specific instructions. In general, the `.bind()` and `.unbind()` methods can be renamed directly to `.on()` and `.off()` respectively since the argument orders are identical.
12010 * @example ​ ````Can bind and unbind events to the colored button.
12011```html
12012<!doctype html>
12013<html lang="en">
12014<head>
12015 <meta charset="utf-8">
12016 <title>unbind demo</title>
12017 <style>
12018 button {
12019 margin: 5px;
12020 }
12021 button#theone {
12022 color: red;
12023 background: yellow;
12024 }
12025 </style>
12026 <script src="https://code.jquery.com/jquery-3.3.1.js"></script>
12027</head>
12028<body>
12029
12030<button id="theone">Does nothing...</button>
12031<button id="bind">Bind Click</button>
12032<button id="unbind">Unbind Click</button>
12033<div style="display:none;">Click!</div>
12034
12035<script>
12036function aClick() {
12037 $( "div" ).show().fadeOut( "slow" );
12038}
12039$( "#bind" ).click(function() {
12040 $( "#theone" )
12041 .bind( "click", aClick )
12042 .text( "Can Click!" );
12043});
12044$( "#unbind" ).click(function() {
12045 $( "#theone" )
12046 .unbind( "click", aClick )
12047 .text( "Does nothing..." );
12048});
12049</script>
12050
12051</body>
12052</html>
12053```
12054 * @example ​ ````To unbind just one previously bound handler, pass the function in as the second argument:
12055```javascript
12056var foo = function() {
12057 // Code to handle some kind of event
12058};
12059
12060$( "p" ).bind( "click", foo ); // ... Now foo will be called when paragraphs are clicked ...
12061
12062$( "p" ).unbind( "click", foo ); // ... foo will no longer be called.
12063```
12064 */
12065 unbind<TType extends string>(
12066 event: TType,
12067 handler: JQuery.TypeEventHandler<TElement, any, TElement, TElement, TType> |
12068 false
12069 ): this;
12070 /**
12071 * Remove a previously-attached event handler from the elements.
12072 * @param event A string containing one or more DOM event types, such as "click" or "submit," or custom event names.
12073 * A jQuery.Event object.
12074 * @see \`{@link https://api.jquery.com/unbind/ }\`
12075 * @since 1.0
12076 * @deprecated ​ Deprecated since 3.0. Use \`{@link off }\`.
12077 *
12078 * **Cause**: These event binding methods have been deprecated in favor of the `.on()` and `.off()` methods which can handle both delegated and direct event binding. Although the older methods are still present in jQuery 3.0, they may be removed as early as the next major-version update.
12079 *
12080 * **Solution**: Change the method call to use `.on()` or `.off()`, the documentation for the old methods include specific instructions. In general, the `.bind()` and `.unbind()` methods can be renamed directly to `.on()` and `.off()` respectively since the argument orders are identical.
12081 * @example ​ ````To unbind all events from all paragraphs, write:
12082```javascript
12083$( "p" ).unbind();
12084```
12085 * @example ​ ````To unbind all click events from all paragraphs, write:
12086```javascript
12087$( "p" ).unbind( "click" );
12088```
12089 */
12090 unbind(event?: string | JQuery.TriggeredEvent<TElement>): this;
12091 /**
12092 * Remove a handler from the event for all elements which match the current selector, based upon a specific set of root elements.
12093 * @param selector A selector which will be used to filter the event results.
12094 * @param eventType A string containing a JavaScript event type, such as "click" or "keydown"
12095 * @param handler A function to execute each time the event is triggered.
12096 * @see \`{@link https://api.jquery.com/undelegate/ }\`
12097 * @since 1.4.2
12098 * @deprecated ​ Deprecated since 3.0. Use \`{@link off }\`.
12099 *
12100 * **Cause**: These event binding methods have been deprecated in favor of the `.on()` and `.off()` methods which can handle both delegated and direct event binding. Although the older methods are still present in jQuery 3.0, they may be removed as early as the next major-version update.
12101 *
12102 * **Solution**: Change the method call to use `.on()` or `.off()`, the documentation for the old methods include specific instructions. In general, the `.bind()` and `.unbind()` methods can be renamed directly to `.on()` and `.off()` respectively since the argument orders are identical.
12103 * @example ​ ````Can bind and unbind events to the colored button.
12104```html
12105<!doctype html>
12106<html lang="en">
12107<head>
12108 <meta charset="utf-8">
12109 <title>undelegate demo</title>
12110 <style>
12111 button {
12112 margin: 5px;
12113 }
12114 button#theone {
12115 color: red;
12116 background: yellow;
12117 }
12118 </style>
12119 <script src="https://code.jquery.com/jquery-3.3.1.js"></script>
12120</head>
12121<body>
12122
12123<button id="theone">Does nothing...</button>
12124<button id="bind">Bind Click</button>
12125<button id="unbind">Unbind Click</button>
12126<div style="display:none;">Click!</div>
12127
12128<script>
12129function aClick() {
12130 $( "div" ).show().fadeOut( "slow" );
12131}
12132$( "#bind" ).click(function() {
12133 $( "body" )
12134 .delegate( "#theone", "click", aClick )
12135 .find( "#theone" ).text( "Can Click!" );
12136});
12137$( "#unbind" ).click(function() {
12138 $( "body" )
12139 .undelegate( "#theone", "click", aClick )
12140 .find( "#theone" ).text( "Does nothing..." );
12141});
12142</script>
12143
12144</body>
12145</html>
12146```
12147 * @example ​ ````To undelegate just one previously bound handler, pass the function in as the third argument:
12148```javascript
12149var foo = function () {
12150 // Code to handle some kind of event
12151};
12152
12153// ... Now foo will be called when paragraphs are clicked ...
12154$( "body" ).delegate( "p", "click", foo );
12155
12156// ... foo will no longer be called.
12157$( "body" ).undelegate( "p", "click", foo );
12158```
12159 */
12160 undelegate<TType extends string>(
12161 selector: JQuery.Selector,
12162 eventType: TType,
12163 handler: JQuery.TypeEventHandler<TElement, any, any, any, TType> |
12164 false
12165 ): this;
12166 /**
12167 * Remove a handler from the event for all elements which match the current selector, based upon a specific set of root elements.
12168 * @param selector A selector which will be used to filter the event results.
12169 * @param eventType_events _&#x40;param_ `eventType_events`
12170 * <br>
12171 * * `eventType` — A string containing a JavaScript event type, such as "click" or "keydown" <br>
12172 * * `events` — An object of one or more event types and previously bound functions to unbind from them.
12173 * @see \`{@link https://api.jquery.com/undelegate/ }\`
12174 * @since 1.4.2
12175 * @since 1.4.3
12176 * @deprecated ​ Deprecated since 3.0. Use \`{@link off }\`.
12177 *
12178 * **Cause**: These event binding methods have been deprecated in favor of the `.on()` and `.off()` methods which can handle both delegated and direct event binding. Although the older methods are still present in jQuery 3.0, they may be removed as early as the next major-version update.
12179 *
12180 * **Solution**: Change the method call to use `.on()` or `.off()`, the documentation for the old methods include specific instructions. In general, the `.bind()` and `.unbind()` methods can be renamed directly to `.on()` and `.off()` respectively since the argument orders are identical.
12181 */
12182 undelegate(selector: JQuery.Selector,
12183 eventType_events: string |
12184 JQuery.TypeEventHandlers<TElement, any, any, any>): this;
12185 /**
12186 * Remove a handler from the event for all elements which match the current selector, based upon a specific set of root elements.
12187 * @param namespace A selector which will be used to filter the event results.
12188 * @see \`{@link https://api.jquery.com/undelegate/ }\`
12189 * @since 1.4.2
12190 * @since 1.6
12191 * @deprecated ​ Deprecated since 3.0. Use \`{@link off }\`.
12192 *
12193 * **Cause**: These event binding methods have been deprecated in favor of the `.on()` and `.off()` methods which can handle both delegated and direct event binding. Although the older methods are still present in jQuery 3.0, they may be removed as early as the next major-version update.
12194 *
12195 * **Solution**: Change the method call to use `.on()` or `.off()`, the documentation for the old methods include specific instructions. In general, the `.bind()` and `.unbind()` methods can be renamed directly to `.on()` and `.off()` respectively since the argument orders are identical.
12196 * @example ​ ````To unbind all delegated events from all paragraphs, write:
12197```javascript
12198$( "p" ).undelegate();
12199```
12200 * @example ​ ````To unbind all delegated click events from all paragraphs, write:
12201```javascript
12202$( "p" ).undelegate( "click" );
12203```
12204 * @example ​ ````To unbind all delegated events by their namespace:
12205```javascript
12206var foo = function() {
12207 // Code to handle some kind of event
12208};
12209
12210// Delegate events under the ".whatever" namespace
12211$( "form" ).delegate( ":button", "click.whatever", foo );
12212
12213$( "form" ).delegate( "input[type='text'] ", "keypress.whatever", foo );
12214
12215// Unbind all events delegated under the ".whatever" namespace
12216$( "form" ).undelegate( ".whatever" );
12217```
12218 */
12219 undelegate(namespace?: string): this;
12220 /**
12221 * Remove the parents of the set of matched elements from the DOM, leaving the matched elements in their place.
12222 * @param selector A selector to check the parent element against. If an element's parent does not match the selector,
12223 * the element won't be unwrapped.
12224 * @see \`{@link https://api.jquery.com/unwrap/ }\`
12225 * @since 1.4
12226 * @since 3.0
12227 * @example ​ ````Wrap/unwrap a div around each of the paragraphs.
12228```html
12229<!doctype html>
12230<html lang="en">
12231<head>
12232 <meta charset="utf-8">
12233 <title>unwrap demo</title>
12234 <style>
12235 div {
12236 border: 2px solid blue;
12237 }
12238 p {
12239 background: yellow;
12240 margin: 4px;
12241 }
12242 </style>
12243 <script src="https://code.jquery.com/jquery-3.3.1.js"></script>
12244</head>
12245<body>
12246​<button>wrap/unwrap</button>
12247<p>Hello</p>
12248<p>cruel</p>
12249<p>World</p>​
12250<script>
12251var pTags = $( "p" );
12252$( "button" ).click(function() {
12253 if ( pTags.parent().is( "div" ) ) {
12254 pTags.unwrap();
12255 } else {
12256 pTags.wrap( "<div></div>" );
12257 }
12258});
12259</script>
12260
12261</body>
12262</html>
12263```
12264 */
12265 unwrap(selector?: string): this;
12266 /**
12267 * Set the value of each element in the set of matched elements.
12268 * @param value_function _&#x40;param_ `value_function`
12269 * <br>
12270 * * `value` — A string of text, a number, or an array of strings corresponding to the value of each matched
12271 * element to set as selected/checked. <br>
12272 * * `function` — A function returning the value to set. `this` is the current element. Receives the index position of
12273 * the element in the set and the old value as arguments.
12274 * @see \`{@link https://api.jquery.com/val/ }\`
12275 * @since 1.0
12276 * @since 1.4
12277 * @example ​ ````Set the value of an input box.
12278```html
12279<!doctype html>
12280<html lang="en">
12281<head>
12282 <meta charset="utf-8">
12283 <title>val demo</title>
12284 <style>
12285 button {
12286 margin: 4px;
12287 cursor: pointer;
12288 }
12289 input {
12290 margin: 4px;
12291 color: blue;
12292 }
12293 </style>
12294 <script src="https://code.jquery.com/jquery-3.3.1.js"></script>
12295</head>
12296<body>
12297
12298<div>
12299 <button>Feed</button>
12300 <button>the</button>
12301 <button>Input</button>
12302</div>
12303<input type="text" value="click a button">
12304
12305<script>
12306$( "button" ).click(function() {
12307 var text = $( this ).text();
12308 $( "input" ).val( text );
12309});
12310</script>
12311
12312</body>
12313</html>
12314```
12315 * @example ​ ````Use the function argument to modify the value of an input box.
12316```html
12317<!doctype html>
12318<html lang="en">
12319<head>
12320 <meta charset="utf-8">
12321 <title>val demo</title>
12322 <script src="https://code.jquery.com/jquery-3.3.1.js"></script>
12323</head>
12324<body>
12325
12326<p>Type something and then click or tab out of the input.</p>
12327<input type="text" value="type something">
12328
12329<script>
12330$( "input" ).on( "blur", function() {
12331 $( this ).val(function( i, val ) {
12332 return val.toUpperCase();
12333 });
12334});
12335</script>
12336
12337</body>
12338</html>
12339```
12340 * @example ​ ````Set a single select, a multiple select, checkboxes and a radio button .
12341```html
12342<!doctype html>
12343<html lang="en">
12344<head>
12345 <meta charset="utf-8">
12346 <title>val demo</title>
12347 <style>
12348 body {
12349 color: blue;
12350 }
12351 </style>
12352 <script src="https://code.jquery.com/jquery-3.3.1.js"></script>
12353</head>
12354<body>
12355
12356<select id="single">
12357 <option>Single</option>
12358 <option>Single2</option>
12359</select>
12360
12361<select id="multiple" multiple="multiple">
12362 <option selected="selected">Multiple</option>
12363 <option>Multiple2</option>
12364 <option selected="selected">Multiple3</option>
12365</select>
12366
12367<br>
12368<input type="checkbox" name="checkboxname" value="check1"> check1
12369<input type="checkbox" name="checkboxname" value="check2"> check2
12370<input type="radio" name="r" value="radio1"> radio1
12371<input type="radio" name="r" value="radio2"> radio2
12372
12373<script>
12374$( "#single" ).val( "Single2" );
12375$( "#multiple" ).val([ "Multiple2", "Multiple3" ]);
12376$( "input").val([ "check1", "check2", "radio1" ]);
12377</script>
12378
12379</body>
12380</html>
12381```
12382 */
12383 val(value_function: string | number | string[] | ((this: TElement, index: number, value: string) => string)): this;
12384 /**
12385 * Get the current value of the first element in the set of matched elements.
12386 * @see \`{@link https://api.jquery.com/val/ }\`
12387 * @since 1.0
12388 * @example ​ ````Get the single value from a single select and an array of values from a multiple select and display their values.
12389```html
12390<!doctype html>
12391<html lang="en">
12392<head>
12393 <meta charset="utf-8">
12394 <title>val demo</title>
12395 <style>
12396 p {
12397 color: red;
12398 margin: 4px;
12399 }
12400 b {
12401 color: blue;
12402 }
12403 </style>
12404 <script src="https://code.jquery.com/jquery-3.3.1.js"></script>
12405</head>
12406<body>
12407
12408<p></p>
12409
12410<select id="single">
12411 <option>Single</option>
12412 <option>Single2</option>
12413</select>
12414
12415<select id="multiple" multiple="multiple">
12416 <option selected="selected">Multiple</option>
12417 <option>Multiple2</option>
12418 <option selected="selected">Multiple3</option>
12419</select>
12420
12421<script>
12422function displayVals() {
12423 var singleValues = $( "#single" ).val();
12424 var multipleValues = $( "#multiple" ).val() || [];
12425 // When using jQuery 3:
12426 // var multipleValues = $( "#multiple" ).val();
12427 $( "p" ).html( "<b>Single:</b> " + singleValues +
12428 " <b>Multiple:</b> " + multipleValues.join( ", " ) );
12429}
12430
12431$( "select" ).change( displayVals );
12432displayVals();
12433</script>
12434
12435</body>
12436</html>
12437```
12438 * @example ​ ````Find the value of an input box.
12439```html
12440<!doctype html>
12441<html lang="en">
12442<head>
12443 <meta charset="utf-8">
12444 <title>val demo</title>
12445 <style>
12446 p {
12447 color: blue;
12448 margin: 8px;
12449 }
12450 </style>
12451 <script src="https://code.jquery.com/jquery-3.3.1.js"></script>
12452</head>
12453<body>
12454
12455<input type="text" value="some text">
12456<p></p>
12457
12458<script>
12459$( "input" )
12460 .keyup(function() {
12461 var value = $( this ).val();
12462 $( "p" ).text( value );
12463 })
12464 .keyup();
12465</script>
12466
12467</body>
12468</html>
12469```
12470 */
12471 val(): string | number | string[] | undefined;
12472 /**
12473 * Set the CSS width of each element in the set of matched elements.
12474 * @param value_function _&#x40;param_ `value_function`
12475 * <br>
12476 * * `value` — An integer representing the number of pixels, or an integer along with an optional unit of measure
12477 * appended (as a string). <br>
12478 * * `function` — A function returning the width to set. Receives the index position of the element in the set and the
12479 * old width as arguments. Within the function, `this` refers to the current element in the set.
12480 * @see \`{@link https://api.jquery.com/width/ }\`
12481 * @since 1.0
12482 * @since 1.4.1
12483 * @example ​ ````Change the width of each div the first time it is clicked (and change its color).
12484```html
12485<!doctype html>
12486<html lang="en">
12487<head>
12488 <meta charset="utf-8">
12489 <title>width demo</title>
12490 <style>
12491 div {
12492 width: 70px;
12493 height: 50px;
12494 float: left;
12495 margin: 5px;
12496 background: red;
12497 cursor: pointer;
12498 }
12499 .mod {
12500 background: blue;
12501 cursor: default;
12502 }
12503 </style>
12504 <script src="https://code.jquery.com/jquery-3.3.1.js"></script>
12505</head>
12506<body>
12507
12508<div>d</div>
12509<div>d</div>
12510<div>d</div>
12511<div>d</div>
12512<div>d</div>
12513
12514<script>
12515var modWidth = 50;
12516$( "div" ).one( "click", function() {
12517 $( this ).width( modWidth ).addClass( "mod" );
12518 modWidth -= 8;
12519});
12520</script>
12521
12522</body>
12523</html>
12524```
12525 */
12526 width(value_function: string | number | ((this: TElement, index: number, value: number) => string | number)): this;
12527 /**
12528 * Get the current computed width for the first element in the set of matched elements.
12529 * @see \`{@link https://api.jquery.com/width/ }\`
12530 * @since 1.0
12531 * @example ​ ````Show various widths. Note the values are from the iframe so might be smaller than you expected. The yellow highlight shows the iframe body.
12532```html
12533<!doctype html>
12534<html lang="en">
12535<head>
12536 <meta charset="utf-8">
12537 <title>width demo</title>
12538 <style>
12539 body {
12540 background: yellow;
12541 }
12542 button {
12543 font-size: 12px;
12544 margin: 2px;
12545 }
12546 p {
12547 width: 150px;
12548 border: 1px red solid;
12549 }
12550 div {
12551 color: red;
12552 font-weight: bold;
12553 }
12554 </style>
12555 <script src="https://code.jquery.com/jquery-3.3.1.js"></script>
12556</head>
12557<body>
12558
12559<button id="getp">Get Paragraph Width</button>
12560<button id="getd">Get Document Width</button>
12561<button id="getw">Get Window Width</button>
12562<div>&nbsp;</div>
12563<p>
12564 Sample paragraph to test width
12565</p>
12566
12567<script>
12568function showWidth( ele, w ) {
12569 $( "div" ).text( "The width for the " + ele + " is " + w + "px." );
12570}
12571$( "#getp" ).click(function() {
12572 showWidth( "paragraph", $( "p" ).width() );
12573});
12574$( "#getd" ).click(function() {
12575 showWidth( "document", $( document ).width() );
12576});
12577$("#getw").click(function() {
12578 showWidth( "window", $( window ).width() );
12579});
12580</script>
12581
12582</body>
12583</html>
12584```
12585 */
12586 width(): number | undefined;
12587 /**
12588 * Wrap an HTML structure around each element in the set of matched elements.
12589 * @param wrappingElement_function _&#x40;param_ `wrappingElement_function`
12590 * <br>
12591 * * `wrappingElement` — A selector, element, HTML string, or jQuery object specifying the structure to wrap around the
12592 * matched elements. When you pass a jQuery collection containing more than one element, or a selector
12593 * matching more than one element, the first element will be used. <br>
12594 * * `function` — A callback function returning the HTML content or jQuery object to wrap around the matched elements.
12595 * Receives the index position of the element in the set as an argument. Within the function, `this`
12596 * refers to the current element in the set.
12597 * @see \`{@link https://api.jquery.com/wrap/ }\`
12598 * @since 1.0
12599 * @since 1.4
12600 * @example ​ ````Wrap a new div around all of the paragraphs.
12601```html
12602<!doctype html>
12603<html lang="en">
12604<head>
12605 <meta charset="utf-8">
12606 <title>wrap demo</title>
12607 <style>
12608 div {
12609 border: 2px solid blue;
12610 }
12611 p {
12612 background: yellow;
12613 margin: 4px;
12614 }
12615 </style>
12616 <script src="https://code.jquery.com/jquery-3.3.1.js"></script>
12617</head>
12618<body>
12619
12620<p>Hello</p>
12621<p>cruel</p>
12622<p>World</p>
12623
12624<script>
12625$( "p" ).wrap( "<div></div>" );
12626</script>
12627
12628</body>
12629</html>
12630```
12631 * @example ​ ````Wraps a newly created tree of objects around the spans. Notice anything in between the spans gets left out like the &lt;strong&gt; (red text) in this example. Even the white space between spans is left out. Click View Source to see the original html.&gt;
12632```html
12633<!doctype html>
12634<html lang="en">
12635<head>
12636 <meta charset="utf-8">
12637 <title>wrap demo</title>
12638 <style>
12639 div {
12640 border: 2px blue solid;
12641 margin: 2px;
12642 padding: 2px;
12643 }
12644 p {
12645 background: yellow;
12646 margin: 2px;
12647 padding: 2px;
12648 }
12649 strong {
12650 color: red;
12651 }
12652 </style>
12653 <script src="https://code.jquery.com/jquery-3.3.1.js"></script>
12654</head>
12655<body>
12656
12657<span>Span Text</span>
12658<strong>What about me?</strong>
12659<span>Another One</span>
12660
12661<script>
12662$( "span" ).wrap( "<div><div><p><em><b></b></em></p></div></div>" );
12663</script>
12664
12665</body>
12666</html>
12667```
12668 * @example ​ ````Wrap a new div around all of the paragraphs.
12669```html
12670<!doctype html>
12671<html lang="en">
12672<head>
12673 <meta charset="utf-8">
12674 <title>wrap demo</title>
12675 <style>
12676 div {
12677 border: 2px solid blue;
12678 }
12679 p {
12680 background: yellow;
12681 margin: 4px;
12682 }
12683 </style>
12684 <script src="https://code.jquery.com/jquery-3.3.1.js"></script>
12685</head>
12686<body>
12687
12688<p>Hello</p>
12689<p>cruel</p>
12690<p>World</p>
12691
12692<script>
12693$( "p" ).wrap( document.createElement( "div" ) );
12694</script>
12695
12696</body>
12697</html>
12698```
12699 * @example ​ ````Wrap a jQuery object double depth div around all of the paragraphs. Notice it doesn&#39;t move the object but just clones it to wrap around its target.
12700```html
12701<!doctype html>
12702<html lang="en">
12703<head>
12704 <meta charset="utf-8">
12705 <title>wrap demo</title>
12706 <style>
12707 div {
12708 border: 2px solid blue;
12709 margin: 2px;
12710 padding: 2px;
12711 }
12712 .doublediv {
12713 border-color: red;
12714 }
12715 p {
12716 background: yellow;
12717 margin: 4px;
12718 font-size: 14px;
12719 }
12720 </style>
12721 <script src="https://code.jquery.com/jquery-3.3.1.js"></script>
12722</head>
12723<body>
12724
12725<p>Hello</p>
12726<p>cruel</p>
12727<p>World</p>
12728<div class="doublediv"><div></div></div>
12729
12730<script>
12731$( "p" ).wrap( $( ".doublediv" ) );
12732</script>
12733
12734</body>
12735</html>
12736```
12737 */
12738 wrap(wrappingElement_function: JQuery.Selector | JQuery.htmlString | Element | JQuery | ((this: TElement, index: number) => string | JQuery)): this;
12739 /**
12740 * Wrap an HTML structure around all elements in the set of matched elements.
12741 * @param wrappingElement_function _&#x40;param_ `wrappingElement_function`
12742 * <br>
12743 * * `wrappingElement` — A selector, element, HTML string, or jQuery object specifying the structure to wrap around the matched elements. <br>
12744 * * `function` — A callback function returning the HTML content or jQuery object to wrap around all the matched
12745 * elements. Within the function, `this` refers to the first element in the set. **Prior to jQuery
12746 * 3.0**, the callback was incorrectly called for every element in the set and received the index
12747 * position of the element in the set as an argument.
12748 * @see \`{@link https://api.jquery.com/wrapAll/ }\`
12749 * @since 1.2
12750 * @since 1.4
12751 * @example ​ ````Wrap a new div around all of the paragraphs.
12752```html
12753<!doctype html>
12754<html lang="en">
12755<head>
12756 <meta charset="utf-8">
12757 <title>wrapAll demo</title>
12758 <style>
12759 div {
12760 border: 2px solid blue;
12761 }
12762 p {
12763 background: yellow;
12764 margin: 4px;
12765 }
12766 </style>
12767 <script src="https://code.jquery.com/jquery-3.3.1.js"></script>
12768</head>
12769<body>
12770
12771<p>Hello</p>
12772<p>cruel</p>
12773<p>World</p>
12774
12775<script>
12776$( "p" ).wrapAll( "<div></div>" );
12777</script>
12778
12779</body>
12780</html>
12781```
12782 * @example ​ ````Wraps a newly created tree of objects around the spans. Notice anything in between the spans gets left out like the &lt;strong&gt; (red text) in this example. Even the white space between spans is left out. Click View Source to see the original html.
12783```html
12784<!doctype html>
12785<html lang="en">
12786<head>
12787 <meta charset="utf-8">
12788 <title>wrapAll demo</title>
12789 <style>
12790 div {
12791 border: 2px blue solid;
12792 margin: 2px;
12793 padding: 2px;
12794 }
12795 p {
12796 background: yellow;
12797 margin: 2px;
12798 padding: 2px;
12799 }
12800 strong {
12801 color: red;
12802 }
12803 </style>
12804 <script src="https://code.jquery.com/jquery-3.3.1.js"></script>
12805</head>
12806<body>
12807
12808<span>Span Text</span>
12809<strong>What about me?</strong>
12810<span>Another One</span>
12811
12812<script>
12813$( "span").wrapAll( "<div><div><p><em><b></b></em></p></div></div>" );
12814</script>
12815
12816</body>
12817</html>
12818```
12819 * @example ​ ````Wrap a new div around all of the paragraphs.
12820```html
12821<!doctype html>
12822<html lang="en">
12823<head>
12824 <meta charset="utf-8">
12825 <title>wrapAll demo</title>
12826 <style>
12827 div {
12828 border: 2px solid blue;
12829 }
12830 p {
12831 background: yellow;
12832 margin: 4px;
12833 }
12834 </style>
12835 <script src="https://code.jquery.com/jquery-3.3.1.js"></script>
12836</head>
12837<body>
12838
12839<p>Hello</p>
12840<p>cruel</p>
12841<p>World</p>
12842
12843<script>
12844$( "p" ).wrapAll( document.createElement( "div" ) );
12845</script>
12846
12847</body>
12848</html>
12849```
12850 * @example ​ ````Wrap a jQuery object double depth div around all of the paragraphs. Notice it doesn&#39;t move the object but just clones it to wrap around its target.
12851```html
12852<!doctype html>
12853<html lang="en">
12854<head>
12855 <meta charset="utf-8">
12856 <title>wrapAll demo</title>
12857 <style>
12858 div {
12859 border: 2px solid blue;
12860 margin: 2px;
12861 padding: 2px;
12862 }
12863 .doublediv {
12864 border-color: red;
12865 }
12866 p {
12867 background: yellow;
12868 margin: 4px;
12869 font-size: 14px;
12870 }
12871 </style>
12872 <script src="https://code.jquery.com/jquery-3.3.1.js"></script>
12873</head>
12874<body>
12875
12876<p>Hello</p>
12877<p>cruel</p>
12878<p>World</p>
12879<div class="doublediv"><div></div></div>
12880
12881<script>
12882$( "p" ).wrapAll( $( ".doublediv" ) );
12883</script>
12884
12885</body>
12886</html>
12887```
12888 */
12889 wrapAll(wrappingElement_function: JQuery.Selector | JQuery.htmlString | Element | JQuery | ((this: TElement) => string | JQuery)): this;
12890 /**
12891 * Wrap an HTML structure around the content of each element in the set of matched elements.
12892 * @param wrappingElement_function _&#x40;param_ `wrappingElement_function`
12893 * <br>
12894 * * `wrappingElement` — An HTML snippet, selector expression, jQuery object, or DOM element specifying the structure to wrap
12895 * around the content of the matched elements. <br>
12896 * * `function` — A callback function which generates a structure to wrap around the content of the matched elements.
12897 * Receives the index position of the element in the set as an argument. Within the function, `this`
12898 * refers to the current element in the set.
12899 * @see \`{@link https://api.jquery.com/wrapInner/ }\`
12900 * @since 1.2
12901 * @since 1.4
12902 * @example ​ ````Selects all paragraphs and wraps a bold tag around each of its contents.
12903```html
12904<!doctype html>
12905<html lang="en">
12906<head>
12907 <meta charset="utf-8">
12908 <title>wrapInner demo</title>
12909 <style>
12910 p {
12911 background: #bbf;
12912 }
12913 </style>
12914 <script src="https://code.jquery.com/jquery-3.3.1.js"></script>
12915</head>
12916<body>
12917
12918<p>Hello</p>
12919<p>cruel</p>
12920<p>World</p>
12921
12922<script>
12923$( "p" ).wrapInner( "<b></b>" );
12924</script>
12925
12926</body>
12927</html>
12928```
12929 * @example ​ ````Wraps a newly created tree of objects around the inside of the body.
12930```html
12931<!doctype html>
12932<html lang="en">
12933<head>
12934 <meta charset="utf-8">
12935 <title>wrapInner demo</title>
12936 <style>
12937 div {
12938 border: 2px green solid;
12939 margin: 2px;
12940 padding: 2px;
12941 }
12942 p {
12943 background: yellow;
12944 margin: 2px;
12945 padding: 2px;
12946 }
12947 </style>
12948 <script src="https://code.jquery.com/jquery-3.3.1.js"></script>
12949</head>
12950<body>
12951
12952Plain old text, or is it?
12953
12954<script>
12955$( "body" ).wrapInner( "<div><div><p><em><b></b></em></p></div></div>" );
12956</script>
12957
12958</body>
12959</html>
12960```
12961 * @example ​ ````Selects all paragraphs and wraps a bold tag around each of its contents.
12962```html
12963<!doctype html>
12964<html lang="en">
12965<head>
12966 <meta charset="utf-8">
12967 <title>wrapInner demo</title>
12968 <style>
12969 p {
12970 background: #9f9;
12971 }
12972 </style>
12973 <script src="https://code.jquery.com/jquery-3.3.1.js"></script>
12974</head>
12975<body>
12976
12977<p>Hello</p>
12978<p>cruel</p>
12979<p>World</p>
12980
12981<script>
12982$( "p" ).wrapInner( document.createElement( "b" ) );
12983</script>
12984
12985</body>
12986</html>
12987```
12988 * @example ​ ````Selects all paragraphs and wraps a jQuery object around each of its contents.
12989```html
12990<!doctype html>
12991<html lang="en">
12992<head>
12993 <meta charset="utf-8">
12994 <title>wrapInner demo</title>
12995 <style>
12996 p {
12997 background: #9f9;
12998 }
12999 .red {
13000 color: red;
13001 }
13002 </style>
13003 <script src="https://code.jquery.com/jquery-3.3.1.js"></script>
13004</head>
13005<body>
13006
13007<p>Hello</p>
13008<p>cruel</p>
13009<p>World</p>
13010
13011<script>
13012$( "p" ).wrapInner( $( "<span class='red'></span>" ) );
13013</script>
13014
13015</body>
13016</html>
13017```
13018 */
13019 wrapInner(wrappingElement_function: JQuery.Selector | JQuery.htmlString | Element | JQuery | ((this: TElement, index: number) => string | JQuery | Element)): this;
13020
13021 [n: number]: TElement;
13022}
13023
\No newline at end of file