【发布时间】:2021-07-06 16:58:41
【问题描述】:
我想根据用户提供的输入添加到现有文本中,
下面是我想要达到的目标
<html>
<p>Enter the IDs of devices seperated by comma</p>
<input id="devicesIDs"></input>
<script>
function ButtonClicked(devicesIDs):
var IDs = document.getElementById("devicesIDs").innerText;
var inputArray = IDs.split(',');
let obj = {
"c8y_isDynamicGroup": {
"invisible": true
},
"type": "c8y_DynamicGroup",
"name": " SmartGroupSendMessageXXX",
"hajjMessage": "messages typed in the widget",
"c8y_DeviceQueryString": "$filter=((id eq '**{{entered ID1}}**') or (id eq '**entered ID2**')) or (id eq '**entered ID3**'))"
}
console.log(obj)
postData('......url....', obj)
.then(data => {
console.log(postData)
console.log(data);
});
</script>
我需要在原文中添加“or (id eq 'entered ID3'))” $filter=((id eq '{{entered ID1}}') 如果输入了多个 ID,根据 ID 的数量,并在其中包含每个 ID
【问题讨论】:
标签: javascript arrays input