回答編集履歴

3

調整

2021/04/21 04:30

投稿

yambejp
yambejp

スコア114968

test CHANGED
@@ -6,9 +6,7 @@
6
6
 
7
7
  $(this).text(function(){
8
8
 
9
- var t=$(this).text();
10
-
11
- return t.replace(/[降昇](?=順)/,function(m){
9
+ return $(this).text().replace(/[降昇](?=順)/,function(m){
12
10
 
13
11
  return {'降':'昇','昇':'降'}[m];
14
12
 

2

微調整

2021/04/21 04:30

投稿

yambejp
yambejp

スコア114968

test CHANGED
@@ -8,7 +8,11 @@
8
8
 
9
9
  var t=$(this).text();
10
10
 
11
+ return t.replace(/[降昇](?=順)/,function(m){
12
+
11
- return /順/.test(t)?t.replace(/降順/,'昇'):t.replace(/昇順/,'降');
13
+ return {'':'昇','昇':'降'}[m];
14
+
15
+ })
12
16
 
13
17
  });
14
18
 
@@ -23,3 +27,5 @@
23
27
  });
24
28
 
25
29
  ```
30
+
31
+ ※調整

1

chousei

2021/04/21 04:29

投稿

yambejp
yambejp

スコア114968

test CHANGED
@@ -3,6 +3,14 @@
3
3
  $(function(){
4
4
 
5
5
  $('#reverse').on('click',function(){
6
+
7
+ $(this).text(function(){
8
+
9
+ var t=$(this).text();
10
+
11
+ return /降順/.test(t)?t.replace(/降順/,'昇順'):t.replace(/昇順/,'降順');
12
+
13
+ });
6
14
 
7
15
  $('ol').append($('.papers').get().reverse()).attr('reversed',function(){
8
16