瀏覽代碼

Listing 5.3: setting id with a value callback.

Frederic G. MARAND 9 年之前
父節點
當前提交
fdb0db2c1b
共有 1 個文件被更改,包括 4 次插入1 次删除
  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;
+    }
   });
 });