質問編集履歴

2

javascriptからjQueryに変更しました。

2018/10/30 00:54

投稿

akinco
akinco

スコア17

test CHANGED
File without changes
test CHANGED
@@ -32,11 +32,15 @@
32
32
 
33
33
  ```js
34
34
 
35
- 'use strict';
35
+ $(function() {
36
36
 
37
- jQuery('.sp-slide>a').attr('title', function(){
37
+ $('p.sp-layer').each(function(index, element) {
38
38
 
39
- return this.nextElementSibling.innerHTML;
39
+ const target = $(element);
40
+
41
+ target.parent().find('a').prop('title', target.text());
42
+
43
+ });
40
44
 
41
45
  });
42
46
 
@@ -60,7 +64,7 @@
60
64
 
61
65
  const target = $(element);
62
66
 
63
- target.parent().find('a').prop('title', target.text());
67
+ target.parent().find('a').prop('title', target.html());
64
68
 
65
69
  });
66
70
 

1

jsを変更しました。

2018/10/30 00:54

投稿

akinco
akinco

スコア17

test CHANGED
File without changes
test CHANGED
@@ -54,11 +54,15 @@
54
54
 
55
55
  ```js
56
56
 
57
- 'use strict';
57
+ $(function() {
58
58
 
59
- jQuery('.sp-slide>a').attr('title', function(){
59
+ $('p.sp-layer').each(function(index, element) {
60
60
 
61
- return this.nextElementSibling.innerText;
61
+ const target = $(element);
62
+
63
+ target.parent().find('a').prop('title', target.text());
64
+
65
+ });
62
66
 
63
67
  });
64
68