回答編集履歴

1

markdown修正

2015/10/13 09:51

投稿

think49
think49

スコア18156

test CHANGED
@@ -10,4 +10,14 @@
10
10
 
11
11
 
12
12
 
13
- また、標準は `getSelection()` なので ()` を優先した方が良いと思います。
13
+ また、標準は `getSelection()` なので `getSelection()` を優先した方が良いと思います。
14
+
15
+
16
+
17
+ ```JavaScript
18
+
19
+ var doc = document,
20
+
21
+ txt = typeof doc.getSelection === 'function' ? doc.getSelection().toString() : doc.selection.createRange().text;
22
+
23
+ ```