Hi!
I'm new in the use of javascript and i'm trying to write a script that copy a component, place it in a specified position and then change its suffix. The js code i wrote copy and move correctly the new component but when i change the prefix it doesn't change on the screen while in the attribute i can see it correctly like shown in the picture. Can anyone help me?
![Untitled.jpg](//image.easyeda.com/pullimage/qaATzIbSvaJQ6GxF7HrMuu2stKdg8viEHnryAbfo.jpeg)
The code is the following:
```
create_TP("gge2",2.54,2.54,"TIP2");
```
```
function create_TP (id,x_mm,y_mm,reference) {
var newId = api('clone', {ids:[id]}); // create clone
api('moveObjsTo', {objs:newId, x: api('unitConvert', {type:'mm2pixel',value:x_mm}), y: api('unitConvert', {type:'mm2pixel',value:y_mm})});
var json = api('getSource', {type:'json'});
json.FOOTPRINT[newId].TEXT[Object.keys(json.FOOTPRINT[newId].TEXT)[0]].text="TP2";
//alert(json.FOOTPRINT[newId].TEXT[Object.keys(json.FOOTPRINT[newId].TEXT)[0]].text);
api('applySource', {source: json, createNew: !true});
}
```
Thank you.
Andrea.
Chrome
70.0.3538.77
Windows
10
EasyEDA
5.8.20