@@ -358,27 +358,27 @@ will be show next):
358
358
359
359
..code-block ::javascript
360
360
361
- // Get the ul that holds the collection of tags
362
- var collectionHolder= $ (' ul.tags' );
363
-
364
361
// setup an "add a tag" link
365
- var $ addTagLink= $ (' <a href="#">Add a tag</a>' );
366
- var $ newLinkLi= $ (' <li></li>' ).append ($ addTagLink);
362
+ var addTagLink= $ (' <a href="#">Add a tag</a>' );
363
+ var newLinkLi= $ (' <li></li>' ).append (addTagLink);
367
364
368
365
jQuery (document ).ready (function () {
366
+ // Get the ul that holds the collection of tags
367
+ var collectionHolder= $ (' ul.tags' );
368
+
369
369
// add the "add a tag" anchor and li to the tags ul
370
- collectionHolder .append ($ newLinkLi);
370
+ collectionHolder .append (newLinkLi);
371
371
372
372
// count the current form inputs we have (e.g. 2), use that as the new
373
373
// index when inserting a new item (e.g. 2)
374
374
collectionHolder .data (' index' ,collectionHolder .find (' :input' ).length );
375
375
376
- $ addTagLink .on (' click' ,function (e ) {
376
+ addTagLink .on (' click' ,function (e ) {
377
377
// prevent the link from creating a "#" on the URL
378
378
e .preventDefault ();
379
379
380
380
// add a new tag form (see next code block)
381
- addTagForm (collectionHolder,$ newLinkLi);
381
+ addTagForm (collectionHolder, newLinkLi);
382
382
});
383
383
});
384
384
@@ -393,7 +393,7 @@ one example:
393
393
394
394
..code-block ::javascript
395
395
396
- function addTagForm (collectionHolder ,$ newLinkLi ) {
396
+ function addTagForm (collectionHolder ,newLinkLi ) {
397
397
// Get the data-prototype explained earlier
398
398
var prototype= collectionHolder .data (' prototype' );
399
399
@@ -408,8 +408,8 @@ one example:
408
408
collectionHolder .data (' index' , index+ 1 );
409
409
410
410
// Display the form in the page in an li, before the "Add a tag" link li
411
- var $ newFormLi= $ (' <li></li>' ).append (newForm);
412
- $ newLinkLi .before ($ newFormLi);
411
+ var newFormLi= $ (' <li></li>' ).append (newForm);
412
+ newLinkLi .before (newFormLi);
413
413
}
414
414
415
415
..note ::