Add information to a Look Up

I would like to add the ID of the Lookup I am doing where I am getting Positions from another list.
I have read the below article
https://plumsail.com/docs/forms/how-to/lookup-view.html
but it says that the ID is an automatic retrieved Field how to I just append that to the end of my lookup Position Text?
Thanks
Jennifer

Hi Jennifer,

Please try this code:

fd.spBeforeRender(function() {
    var template = '';
    template += '#: data.Title + " - " + data.Id  #';
    fd.field('LookupInternalName').widgetOptions = {
        template: template,
    }
});

This worked. However I was wondering if there is a way to add text in front of it so that I could explain what the line is
I tried
template += '

#: data.Id ? " " + data.Id : “”
And placing test in the “” after the ? but it errors I can only place a - or $

Hi!

Hmm, let’s make minor edits:

template += '#: "Yout text " + data.Title + " - " + data.Id #';

but you also can use this construction:

template += '#: data.Id ? " Your text " + data.Id : "" #';