回答編集履歴

1

実装例追加

2018/09/13 06:03

投稿

x_x
x_x

スコア13749

test CHANGED
@@ -7,3 +7,27 @@
7
7
 
8
8
 
9
9
  [https://developer.mozilla.org/ja/docs/Web/Security/Securing_your_site/Turning_off_form_autocompletion#The_autocomplete_attribute_and_login_fields#Use_jQuery_disableAutoFill_Plugin](https://developer.mozilla.org/ja/docs/Web/Security/Securing_your_site/Turning_off_form_autocompletion#The_autocomplete_attribute_and_login_fields#Use_jQuery_disableAutoFill_Plugin)
10
+
11
+
12
+
13
+ -- 実装例追加
14
+
15
+
16
+
17
+ ```JavaScript
18
+
19
+ document.addEventListener('DOMContentLoaded', event => {
20
+
21
+ const sx = '-' + btoa(location.pathname);
22
+
23
+ document.querySelectorAll('input[name]').forEach(v => { v.dataset['name'] = v.name; v.name += sx; });
24
+
25
+ document.addEventListener('submit', event => {
26
+
27
+ document.querySelectorAll('input[name][data-name]').forEach(v => v.name = v.dataset['name']);
28
+
29
+ });
30
+
31
+ });
32
+
33
+ ```