2020-08-20 03:10:04 +02:00
|
|
|
/**
|
|
|
|
* Invoice Ninja (https://invoiceninja.com)
|
|
|
|
*
|
|
|
|
* @link https://github.com/invoiceninja/invoiceninja source repository
|
|
|
|
*
|
2021-01-13 09:22:36 +01:00
|
|
|
* @copyright Copyright (c) 2021. Invoice Ninja LLC (https://invoiceninja.com)
|
2020-08-20 03:10:04 +02:00
|
|
|
*
|
2022-06-08 06:25:44 +02:00
|
|
|
* @license https://www.elastic.co/licensing/elastic-license
|
2020-08-20 03:10:04 +02:00
|
|
|
*/
|
|
|
|
|
|
|
|
const appendToElement = (parent, value) => {
|
|
|
|
let _parent = document.getElementById(parent);
|
|
|
|
|
|
|
|
let _possibleElement = _parent.querySelector(`input[value="${value}"]`);
|
|
|
|
|
|
|
|
if (_possibleElement) {
|
|
|
|
return _possibleElement.remove();
|
|
|
|
}
|
|
|
|
|
|
|
|
let _temp = document.createElement('INPUT');
|
|
|
|
|
|
|
|
_temp.setAttribute('name', 'file_hash[]');
|
|
|
|
_temp.setAttribute('value', value);
|
|
|
|
_temp.hidden = true;
|
|
|
|
|
|
|
|
_parent.append(_temp);
|
2022-02-18 11:45:01 +01:00
|
|
|
|
2020-08-20 03:10:04 +02:00
|
|
|
};
|
|
|
|
|
|
|
|
window.appendToElement = appendToElement;
|