diff --git a/module/actor-sheet.js b/module/actor-sheet.js
index e8a153a..cd279a9 100644
--- a/module/actor-sheet.js
+++ b/module/actor-sheet.js
@@ -82,9 +82,15 @@ export class SimpleActorSheet extends ActorSheet {
// Add new attribute
if ( action === "create" ) {
- const nk = Object.keys(attrs).length + 1;
+ const objKeys = Object.keys(attrs);
+ let nk = Object.keys(attrs).length + 1;
+ let newValue = `attr${nk}`;
let newKey = document.createElement("div");
- newKey.innerHTML = ``;
+ while ( objKeys.includes(newValue) ) {
+ ++nk;
+ newValue = `attr${nk}`;
+ };
+ newKey.innerHTML = ``;
newKey = newKey.children[0];
form.appendChild(newKey);
await this._onSubmit(event);
diff --git a/module/item-sheet.js b/module/item-sheet.js
index a743a5f..c516f1b 100644
--- a/module/item-sheet.js
+++ b/module/item-sheet.js
@@ -67,9 +67,15 @@ export class SimpleItemSheet extends ItemSheet {
// Add new attribute
if ( action === "create" ) {
- const nk = Object.keys(attrs).length + 1;
+ const objKeys = Object.keys(attrs);
+ let nk = Object.keys(attrs).length + 1;
+ let newValue = `attr${nk}`;
let newKey = document.createElement("div");
- newKey.innerHTML = ``;
+ while ( objKeys.includes(newValue) ) {
+ ++nk;
+ newValue = `attr${nk}`;
+ }
+ newKey.innerHTML = ``;
newKey = newKey.children[0];
form.appendChild(newKey);
await this._onSubmit(event);