Explorar o código

Listing 5.3: setting id with a value callback.

Frederic G. MARAND %!s(int64=9) %!d(string=hai) anos
pai
achega
fdb0db2c1b
Modificáronse 1 ficheiros con 4 adicións e 1 borrados
  1. 4 1
      Chapter 5/05.js

+ 4 - 1
Chapter 5/05.js

@@ -4,6 +4,9 @@ $(document).ready(function () {
 
   $('div.chapter a').attr({
     rel: 'external',
-    title: 'Learn more at Wikipedia'
+    title: 'Learn more at Wikipedia',
+    id: function (index, oldValue) {
+      return 'wikilink-' + index;
+    }
   });
 });