Reputation: 1
I got a textbox with name=moderator[custom] and id=moderator-custom, I already have a addon that adds text inside a textbox using custom generators based on name=, it adds text, but the textbox already got random text everytime and I just want to add a text at the end of all that info.
The custom generator that I use to insert the text:
var text1 = faker.random.arrayElement([
'hello!',
]);
return text1;
How should it look to place the "Hello!" at the end of all te info, keeping the text there too.
Upvotes: 0
Views: 391
Reputation: 2175
there are three steps involved in doing what you want.
Retrieve the existing value in the control
Append the new value to the retrieved value
Re-assign it to the control.
var item = document.getElementById(moderator-custom");
var text1 = faker.random.arrayElement([
'hello!',
]);
item.value += text1.value;
Upvotes: 1