-
Notifications
You must be signed in to change notification settings - Fork 2
/
jqueryvsdojo.html
597 lines (559 loc) · 31.9 KB
/
jqueryvsdojo.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
<!doctype html>
<html class="no-js" lang="">
<head>
<meta charset="utf-8">
<meta http-equiv="x-ua-compatible" content="ie=edge">
<title>Anology.Script</title>
<meta name="description" content="">
<meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
<link rel="manifest" href="site.webmanifest">
<link rel="apple-touch-icon" href="icon.png">
<!-- Place favicon.ico in the root directory -->
<link href="https://fonts.googleapis.com/css?family=Fira+Sans:400,500,800,900" rel="stylesheet">
<link rel="stylesheet" href="css/styles.css">
</head>
<body class="font-fira">
<!--[if lte IE 9]>
<p class="browserupgrade">You are using an <strong>outdated</strong> browser. Please <a href="https://browsehappy.com/">upgrade your browser</a> to improve your experience and security.</p>
<![endif]-->
<!-- Add your site or application content here -->
<header class="text-center pt-4 flex content-center items-center justify-center">
<div class="w-1/5 h-12 inline-flex items-center justify-center md:invisible">
<div class="button_container" id="toggle">
<span class="top"></span>
<span class="middle"></span>
<span class="bottom"></span>
</div>
</div>
<div class="w-3/5 h-12 py-3">
<a class="block text-black hover:text-black no-underline" href="index.html"><span class="text-2xl sm:text-3xl font-black">analogy <span class="font-medium">.script()</span></span></a>
</div>
<div class="w-1/5 h-12"></div>
</header>
<section class="overlay" id="overlay">
<nav class="overlay-menu">
<ul>
<li ><a href="#" class="font-medium border-b-2 border-black">Get Started</a></li>
<li><a href="#">Common Idioms</a></li>
<li><a href="#">Events</a></li>
<li><a href="#">Animations & Effects</a></li>
<li><a href="#">Selectors</a></li>
<li><a href="#">Array vs. NodeList</a></li>
<li><a href="#">Ajax</a></li>
<li><a href="#">CSS</a></li>
<li><a href="#">More...</a></li>
</ul>
</nav>
</section>
<main class="container-block">
<h1 class="gr-gradient p-4 my-8 text-center"><span class="font-bold text-4xl text-white m-2 ">jQuery <span class="font-normal text-xl">2.1</span></span>
<span class="text-white font-normal text-2xl text-center">
vs
</span>
<span class="font-bold text-4xl m-2 text-right">dojo <span class="font-normal text-xl">1.7</span></span></h1>
<section class="p-4">
<section>
<h4 class="text-xl font-medium">Getting Started</h4>
<section>
<div class="flex-wrap pt-10 text-center md:text-left md:border-b md:border-grey hidden md:flex">
<div class="w-full md:w-1/4">
</div>
<div class="w-full md:w-1/5 mb-2 ">
<p class="text-jq-color text-lg text-left ">jQuery 2.1</p>
</div>
<div class="w-full md:w-1/5 mb-2 ">
<p class="text-dojo-color text-lg text-left ">dojo 1.7</p>
</div>
<div class="w-full md:w-1/3 mb-2">
<p class="text-lg text-left mt-0 ">Notes</p>
</div>
</div>
<div class="flex flex-wrap pt-10 text-center md:text-left">
<div class="w-full md:w-1/4 mb-4 pb-2 md:text-left border-b border-grey">
Global Objects and functions
</div>
<div class="w-full md:w-1/5 mb-4 pb-4 md:border-b md:border-grey">
<p class="text-jq-color text-lg text-left pb-4 block md:hidden">jQuery 2.1</p>
<code>jQuery</code>
or
<code class="text-jq-color">$</code>
</div>
<div class="w-full md:w-1/5 mb-4 pb-4 md:border-b md:border-grey">
<p class="text-dojo-color text-lg text-left pb-4 block md:hidden">dojo 1.7</p>
<code class="text-dojo-color">dojo</code>
</div>
<div class="w-full md:w-1/3 mb-4 pb-4 md:border-b md:border-grey text-left notes">
<p class="text-lg text-left mt-0 pb-4 block md:hidden">Notes</p>
<p>jQuery provides a function which can be accessed by <code class="text-jq-color">jQuery</code> or <code class="text-jq-color">$</code> which can be used to access all the jQuery methods. Ideally it accepts CSS selectors, searches through the DOM for any elements that match the provided selector and creates a new jQuery object that references these elements.</p>
<p>Similarly <code class="text-dojo-color">dojo</code> has a object which has all the methods.</p>
<p class="py-4">
<span class="rounded-full py-2 px-4 bg-black text-white text-xs">Important</span>
</p>
<p><span class="text-jq-color">jQuery</span> When we access an element with jquery say $(".bar") it returns a jquery object and not just the actual element, on which we can add methods through chaining to work upon.</p>
<p><em>eg.</em> <code class="text-jq-color">$("bar").addClass("foo").removeClass("foe")</code>. And if we want to have only the DOM element, we have to do <code class="text-jq-color">$("bar").get(0)</code></p>
<p> If there are more than one element which matches the criteria jQuery will return an array</p>
<p><span class="text-dojo-color">Dojo</span> However, DOJO will simply return the DOM element or an array in case we use <code class="text-dojo-color">dojo.query("bar")</code>, and it matches quite a few elements.</p>
</div>
</div>
</section>
<section>
<div class="flex flex-wrap pt-10 text-center md:text-left">
<div class="w-full md:w-1/4 mb-4 pb-2 md:text-left border-b border-grey">
DOM Ready
</div>
<div class="w-full md:w-1/5 mb-4 pb-4 md:border-b md:border-grey">
<p class="text-jq-color text-lg text-left pb-4 block md:hidden">jQuery 2.1</p>
<pre><code class="text-jq-color">
$(document).ready(
function(){
// Your code here
}
);
</code></pre>
</div>
<div class="w-full md:w-1/5 mb-4 pb-4 md:border-b md:border-grey">
<p class="text-dojo-color text-lg text-left pb-4 block md:hidden">dojo 1.7</p>
<pre><code class="text-dojo-color">
dojo.ready(
function () {
// Your code here
});
</code></pre>
</div>
<div class="w-full md:w-1/3 mb-4 pb-4 md:border-b md:border-grey text-left notes">
<p class="text-lg text-left mt-0 pb-4 block md:hidden">Notes</p>
<p>Fires when DOM is ready</p>
<strong>jQuery Alternative Usage:</strong>
<pre><code class="text-jq-color">
$(function(){
// Your code here
});
</code></pre>
</div>
</div>
</section>
</section>
<section class="mt-10">
<h4 class="text-xl font-medium">Common Idioms
</h4>
<section>
<div class="flex-wrap pt-10 text-center md:text-left md:border-b md:border-grey hidden md:flex">
<div class="w-full md:w-1/4">
</div>
<div class="w-full md:w-1/5 mb-2 ">
<p class="text-jq-color text-lg text-left ">jQuery 2.1</p>
</div>
<div class="w-full md:w-1/5 mb-2 ">
<p class="text-dojo-color text-lg text-left ">dojo 1.7</p>
</div>
<div class="w-full md:w-1/3 mb-2">
<p class="text-lg text-left mt-0 ">Notes</p>
</div>
</div>
<div class="flex flex-wrap pt-10 text-center md:text-left">
<div class="w-full md:w-1/4 mb-4 pb-2 md:text-left border-b border-grey">
Id Selector
</div>
<div class="w-full md:w-1/5 mb-4 pb-4 md:border-b md:border-grey">
<p class="text-jq-color text-lg text-left pb-4 block md:hidden">jQuery 2.1</p>
<code class="text-jq-color">
$("#bar")
</code>
</div>
<div class="w-full md:w-1/5 mb-4 pb-4 md:border-b md:border-grey">
<p class="text-dojo-color text-lg text-left pb-4 block md:hidden">dojo 1.7</p>
<code class="text-dojo-color">
dojo.byId("bar")
</code>
</div>
<div class="w-full md:w-1/3 mb-4 pb-4 md:border-b md:border-grey text-left notes">
<p class="text-lg text-left mt-0 pb-4 block md:hidden">Notes</p>
<p>
returns the element with id <em>bar</em>.
</p>
</div>
</div>
</section>
<section>
<div class="flex flex-wrap pt-10 text-center md:text-left">
<div class="w-full md:w-1/4 mb-4 pb-2 md:text-left border-b border-grey">
Class Selector
</div>
<div class="w-full md:w-1/5 mb-4 pb-4 md:border-b md:border-grey">
<p class="text-jq-color text-lg text-left pb-4 block md:hidden">jQuery 2.1</p>
<code class="text-jq-color">
$(".foo")
</code>
</div>
<div class="w-full md:w-1/5 mb-4 pb-4 md:border-b md:border-grey">
<p class="text-dojo-color text-lg text-left pb-4 block md:hidden">dojo 1.7</p>
<code class="text-dojo-color">
dojo.byId("bar")
</code>
</div>
<div class="w-full md:w-1/3 mb-4 pb-4 md:border-b md:border-grey text-left notes">
<p class="text-lg text-left mt-0 pb-4 block md:hidden">Notes</p>
<p>Selects all the elements with class <em>foo</em>.</p>
<p><code class="text-jq-color">$(".foo").length</code> & <code class="text-dojo-color">
dojo.query(".foo").length
</code> gives the length of the elements present for the given condition.</p>
</div>
</div>
</section>
<section>
<div class="flex flex-wrap pt-10 text-center md:text-left">
<div class="w-full md:w-1/4 mb-4 pb-2 md:text-left border-b border-grey">
Element Selector
</div>
<div class="w-full md:w-1/5 mb-4 pb-4 md:border-b md:border-grey">
<p class="text-jq-color text-lg text-left pb-4 block md:hidden">jQuery 2.1</p>
<code class="text-jq-color">
$("td").find(".notes")
</code>
</div>
<div class="w-full md:w-1/5 mb-4 pb-4 md:border-b md:border-grey">
<p class="text-dojo-color text-lg text-left pb-4 block md:hidden">dojo 1.7</p>
<code class="text-dojo-color">
dojo.query("td.notes")
</code>
</div>
<div class="w-full md:w-1/3 mb-4 pb-4 md:border-b md:border-grey text-left notes">
<p class="text-lg text-left mt-0 pb-4 block md:hidden">Notes</p>
<p>Gets all the <em>td</em> elements with class notes.</p>
</div>
</div>
</section>
<section>
<div class="flex flex-wrap pt-10 text-center md:text-left">
<div class="w-full md:w-1/4 mb-4 pb-2 md:text-left border-b border-grey">
Pseudo class selectors
</div>
<div class="w-full md:w-1/5 mb-4 pb-4 md:border-b md:border-grey">
<p class="text-jq-color text-lg text-left pb-4 block md:hidden">jQuery 2.1</p>
<code class="text-jq-color">
$(".container:first-child")
</code>
</div>
<div class="w-full md:w-1/5 mb-4 pb-4 md:border-b md:border-grey">
<p class="text-dojo-color text-lg text-left pb-4 block md:hidden">dojo 1.7</p>
<code class="text-dojo-color">
dojo.query(".container:first-child")
</code>
</div>
<div class="w-full md:w-1/3 mb-4 pb-4 md:border-b md:border-grey text-left notes">
<p class="text-lg text-left mt-0 pb-4 block md:hidden">Notes</p>
<p>Get the elements filtered through pseudo classes.</p>
</div>
</div>
</section>
<section>
<div class="flex flex-wrap pt-10 text-center md:text-left">
<div class="w-full md:w-1/4 mb-4 pb-2 md:text-left border-b border-grey">
Creates a new DOM element
</div>
<div class="w-full md:w-1/5 mb-4 pb-4 md:border-b md:border-grey">
<p class="text-jq-color text-lg text-left pb-4 block md:hidden">jQuery 2.1</p>
<code class="text-jq-color">
$("<<span class="hidden">\</span>div/>")
</code>
</div>
<div class="w-full md:w-1/5 mb-4 pb-4 md:border-b md:border-grey">
<p class="text-dojo-color text-lg text-left pb-4 block md:hidden">dojo 1.7</p>
<code class="text-dojo-color">
dojo.create("div")
</code>
</div>
<div class="w-full md:w-1/3 mb-4 pb-4 md:border-b md:border-grey text-left notes">
<p class="text-lg text-left mt-0 pb-4 block md:hidden">Notes</p>
<p>Usage:</p>
<p class="text-jq-color">jQuery</p>
<pre><code class="text-jq-color">
var e = $("<<span class="hidden">\</span>div/>").attr("id","last");
$("body").append(e);
</code></pre>
<p class="text-dojo-color mt-5">dojo</p>
<pre><code class="text-dojo-color">
dojo.create("div",{"id":"last"},dojo.body());
</code></pre>
</div>
</div>
</section>
<section>
<div class="flex flex-wrap pt-10 text-center md:text-left">
<div class="w-full md:w-1/4 mb-4 pb-2 md:text-left border-b border-grey">
Get inner HTML of the element
</div>
<div class="w-full md:w-1/5 mb-4 pb-4 md:border-b md:border-grey">
<p class="text-jq-color text-lg text-left pb-4 block md:hidden">jQuery 2.1</p>
<code class="text-jq-color">
$("#bar".html())
</code>
</div>
<div class="w-full md:w-1/5 mb-4 pb-4 md:border-b md:border-grey">
<p class="text-dojo-color text-lg text-left pb-4 block md:hidden">dojo 1.7</p>
<code class="text-dojo-color">
dojo.byId("bar").innerHTML
</code>
</div>
<div class="w-full md:w-1/3 mb-4 pb-4 md:border-b md:border-grey text-left notes">
<p class="text-lg text-left mt-0 pb-4 block md:hidden">Notes</p>
<p>Even setting the innerHTML is pretty much same</p>
<p class="text-jq-color">jQuery</p>
<code class="text-jq-color">
$("#bar").html("Hola")
</code>
<p class="text-dojo-color mt-5">dojo</p>
<code class="text-dojo-color">
dojo.byId("bar").innerHTML = "Hola"
</code>
</div>
</div>
</section>
<section>
<div class="flex flex-wrap pt-10 text-center md:text-left">
<div class="w-full md:w-1/4 mb-4 pb-2 md:text-left border-b border-grey">
Value of an element
</div>
<div class="w-full md:w-1/5 mb-4 pb-4 md:border-b md:border-grey">
<p class="text-jq-color text-lg text-left pb-4 block md:hidden">jQuery 2.1</p>
<code class="text-jq-color">
$("select:first").val()
</code>
</div>
<div class="w-full md:w-1/5 mb-4 pb-4 md:border-b md:border-grey">
<p class="text-dojo-color text-lg text-left pb-4 block md:hidden">dojo 1.7</p>
<code class="text-dojo-color">
dojo.query("select")[0].value
</code>
</div>
<div class="w-full md:w-1/3 mb-4 pb-4 md:border-b md:border-grey text-left notes">
<p class="text-lg text-left mt-0 pb-4 block md:hidden">Notes</p>
<p>Set the value the same way</p>
<p class="text-jq-color">jQuery</p>
<code class="text-jq-color">
$("select:first").val("Here is the first option")
</code>
<p class="text-dojo-color mt-5">dojo</p>
<code class="text-dojo-color">
dojo.query("select")[0].value = "Here is the first option"
</code>
</div>
</div>
</section>
<section>
<div class="flex flex-wrap pt-10 text-center md:text-left">
<div class="w-full md:w-1/4 mb-4 pb-2 md:text-left border-b border-grey">
Attribute values
</div>
<div class="w-full md:w-1/5 mb-4 pb-4 md:border-b md:border-grey">
<p class="text-jq-color text-lg text-left pb-4 block md:hidden">jQuery 2.1</p>
<pre><code class="text-jq-color">
$(".active a")
.attr("href") //get
$(".active a")
.attr("href", "javascript:void(0);") //set
</code></pre>
</div>
<div class="w-full md:w-1/5 mb-4 pb-4 md:border-b md:border-grey">
<p class="text-dojo-color text-lg text-left pb-4 block md:hidden">dojo 1.7</p>
<pre><code class="text-dojo-color">
dojo.query(".active a")
.attr("href") //get
dojo.query(".active a")
.attr("href", "javascript:void(0);") //set
</code></pre>
</div>
<div class="w-full md:w-1/3 mb-4 pb-4 md:border-b md:border-grey text-left notes">
<p class="text-lg text-left mt-0 pb-4 block md:hidden">Notes</p>
<p>Get and set attribute values</p>
</div>
</div>
</section>
<section>
<div class="flex flex-wrap pt-10 text-center md:text-left">
<div class="w-full md:w-1/4 mb-4 pb-2 md:text-left border-b border-grey">
Trim
</div>
<div class="w-full md:w-1/5 mb-4 pb-4 md:border-b md:border-grey">
<p class="text-jq-color text-lg text-left pb-4 block md:hidden">jQuery 2.1</p>
<code class="text-jq-color">
$.trim(" foo ")
</code>
</div>
<div class="w-full md:w-1/5 mb-4 pb-4 md:border-b md:border-grey">
<p class="text-dojo-color text-lg text-left pb-4 block md:hidden">dojo 1.7</p>
<code class="text-dojo-color">
dojo.trim(" foo ")
</code>
</div>
<div class="w-full md:w-1/3 mb-4 pb-4 md:border-b md:border-grey text-left notes">
<p class="text-lg text-left mt-0 pb-4 block md:hidden">Notes</p>
<p>Trim strings. Examples will return <em>foo</em></p>
</div>
</div>
</section>
<section>
<div class="flex flex-wrap pt-10 text-center md:text-left">
<div class="w-full md:w-1/4 mb-4 pb-2 md:text-left border-b border-grey">
Create and append elements
</div>
<div class="w-full md:w-1/5 mb-4 pb-4 md:border-b md:border-grey">
<p class="text-jq-color text-lg text-left pb-4 block md:hidden">jQuery 2.1</p>
<code class="text-jq-color">
$("body").append('<<span class="hide">\</span>a href="/foo">Foo<<span class="hide">\</span>/a>')
</code>
</div>
<div class="w-full md:w-1/5 mb-4 pb-4 md:border-b md:border-grey">
<p class="text-dojo-color text-lg text-left pb-4 block md:hidden">dojo 1.7</p>
<code class="text-dojo-color">
dojo.create("a", { href: "/foo", innerHTML: "Foo" }, dojo.body());
</code>
</div>
<div class="w-full md:w-1/3 mb-4 pb-4 md:border-b md:border-grey text-left notes">
<p class="text-lg text-left mt-0 pb-4 block md:hidden">Notes</p>
<p>Creates an HTML element and appends to the given node</p>
</div>
</div>
</section>
<section>
<div class="flex flex-wrap pt-10 text-center md:text-left">
<div class="w-full md:w-1/4 mb-4 pb-2 md:text-left border-b border-grey">
Remove an element
</div>
<div class="w-full md:w-1/5 mb-4 pb-4 md:border-b md:border-grey">
<p class="text-jq-color text-lg text-left pb-4 block md:hidden">jQuery 2.1</p>
<code class="text-jq-color">
$("#foo").remove()
</code>
</div>
<div class="w-full md:w-1/5 mb-4 pb-4 md:border-b md:border-grey">
<p class="text-dojo-color text-lg text-left pb-4 block md:hidden">dojo 1.7</p>
<code class="text-dojo-color">
dojo.destroy("foo");
</code>
</div>
<div class="w-full md:w-1/3 mb-4 pb-4 md:border-b md:border-grey text-left notes">
<p class="text-lg text-left mt-0 pb-4 block md:hidden">Notes</p>
<p>Remove the element as per the selector</p>
</div>
</div>
</section>
<section>
<div class="flex flex-wrap pt-10 text-center md:text-left">
<div class="w-full md:w-1/4 mb-4 pb-2 md:text-left border-b border-grey">
Find all the child elements
</div>
<div class="w-full md:w-1/5 mb-4 pb-4 md:border-b md:border-grey">
<p class="text-jq-color text-lg text-left pb-4 block md:hidden">jQuery 2.1</p>
<code class="text-jq-color">
$(body).children();
</code>
</div>
<div class="w-full md:w-1/5 mb-4 pb-4 md:border-b md:border-grey">
<p class="text-dojo-color text-lg text-left pb-4 block md:hidden">dojo 1.7</p>
<code class="text-dojo-color">
dojo.query("body > *")
</code>
</div>
<div class="w-full md:w-1/3 mb-4 pb-4 md:border-b md:border-grey text-left notes">
<p class="text-lg text-left mt-0 pb-4 block md:hidden">Notes</p>
<p>Can use selectors to filter results eg.:</p>
<p class="text-jq-color">jQuery</p>
<code class="text-jq-color">
$("body").children("div")
</code>
<p class="text-dojo-color mt-5">dojo</p>
<code class="text-dojo-color">
dojo.query("body > div")
</code>
</div>
</div>
</section>
</section>
<section class="mt-10">
<h4 class="text-xl font-medium">Events
</h4>
<section>
<div class="flex-wrap pt-10 text-center md:text-left md:border-b md:border-grey hidden md:flex">
<div class="w-full md:w-1/6">
</div>
<div class="w-full md:w-1/4 mb-2 ">
<p class="text-jq-color text-lg text-left ">jQuery 2.1</p>
</div>
<div class="w-full md:w-1/3 mb-2 ">
<p class="text-dojo-color text-lg text-left ">dojo 1.7</p>
</div>
<div class="w-full md:w-1/4 mb-2">
<p class="text-lg text-left mt-0 ">Notes</p>
</div>
</div>
<div class="flex flex-wrap pt-10 text-center md:text-left">
<div class="w-full md:w-1/6 mb-4 pb-2 md:text-left border-b border-grey">
Event Binding
</div>
<div class="w-full md:w-1/4 mb-4 pb-4 md:border-b md:border-grey">
<p class="text-jq-color text-lg text-left pb-4 block md:hidden">jQuery 2.1</p>
<pre><code class="text-jq-color">
$("#foo"). bind("click",
function(){ // do something }
)
</code></pre>
</div>
<div class="w-full md:w-1/3 mb-4 pb-4 md:border-b md:border-grey">
<p class="text-dojo-color text-lg text-left pb-4 block md:hidden">dojo 1.7</p>
<pre><code class="text-dojo-color">
dojo.connect(dojo.byId("foo"),"onclick",this,function(){
// do something
})
</code></pre>
</div>
<div class="w-full md:w-1/4 mb-4 pb-4 md:border-b md:border-grey text-left notes">
<p class="text-lg text-left mt-0 pb-4 block md:hidden">Notes</p>
<p class="md:mt-5">
The third parameter in <code class="text-dojo-color">dojo.connect</code> is the scope in which the following method should be executed.
Most of all the events can be bound this way.
</p>
</div>
</div>
</section>
<section>
<div class="flex flex-wrap pt-10 text-center md:text-left">
<div class="w-full md:w-1/6 mb-4 pb-2 md:text-left border-b border-grey">
Unbind Events
</div>
<div class="w-full md:w-1/4 mb-4 pb-4 md:border-b md:border-grey">
<p class="text-jq-color text-lg text-left pb-4 block md:hidden">jQuery 2.1</p>
<pre><code class="text-jq-color">
$("#foo").unbind()
</code></pre>
</div>
<div class="w-full md:w-1/3 mb-4 pb-4 md:border-b md:border-grey">
<p class="text-dojo-color text-lg text-left pb-4 block md:hidden">dojo 1.7</p>
<pre><code class="text-dojo-color">
var con = dojo.connect( dojo.byId("foo"),"onclick",this,
function(){
// do something
}));
dojo.disconnect(con);
</code></pre>
</div>
<div class="w-full md:w-1/4 mb-4 pb-4 md:border-b md:border-grey text-left notes">
<p class="text-lg text-left mt-0 pb-4 block md:hidden">Notes</p>
<p class="md:mt-5">In dojo you have to assign the <code class="text-dojo-color">dojo.connect</code> to a variable and pass to <code class="text-dojo-color">dojo.disconnect</code> to unbind the event.</p>
</div>
</div>
</section>
</section>
</section>
</main>
<script src="https://code.jquery.com/jquery-3.3.1.min.js" integrity="sha256-FgpCb/KJQlLNfOu91ta32o/NMZxltwRo8QtmkMRdAu8=" crossorigin="anonymous"></script>
<script>window.jQuery || document.write('<script src="js/vendor/jquery-3.3.1.min.js"><\/script>')</script>
<script src="js/main.js"></script>
<!-- Google Analytics: change UA-XXXXX-Y to be your site's ID. -->
<script>
window.ga = function () { ga.q.push(arguments) }; ga.q = []; ga.l = +new Date;
ga('create', 'UA-XXXXX-Y', 'auto'); ga('send', 'pageview')
</script>
<script src="https://www.google-analytics.com/analytics.js" async defer></script>
</body>
</html>