diff --git a/assets/css/style.css b/assets/css/style.css index ff59dbb..784252d 100644 --- a/assets/css/style.css +++ b/assets/css/style.css @@ -383,6 +383,16 @@ input:checked + .slider { cursor: pointer; } +.jsonOutput { + width: 1px; + height: 1px; + border: none; + outline: none; + color: #fff; + background: transparent; + margin: 0; +} + footer { padding: 10px 0; /*position: fixed; diff --git a/assets/js/script.js b/assets/js/script.js index 6f131b5..1db058d 100644 --- a/assets/js/script.js +++ b/assets/js/script.js @@ -362,13 +362,11 @@ $(document).on('click', '#copyCode', function (e) { generateJson() .then(data => { data = JSON.stringify(data, null, 2); - const input = document.createElement('input'); - input.setAttribute('value', data); - document.body.appendChild(input); + document.getElementById("jsonOutput").value = data; + const input = document.getElementById('jsonOutput'); input.select(); input.setSelectionRange(0, 99999); document.execCommand('copy'); - document.body.removeChild(input); alert('کد در کلیپبورد کپی شد.'); }) .catch(error => { diff --git a/index.html b/index.html index 32809bc..a9641b5 100644 --- a/index.html +++ b/index.html @@ -4,7 +4,7 @@ - +