Storing the id will work but why not just cache the jQuery selector in the first place.
That will also then work in cases where the element may not have an id specified.
Another benefit of caching the value to begin with is that you do not have to constantly re-create the jQuery object when you want to use it, saving on performance too.
var $selectTopic;
$('#detailData').on('click', '.select-topic', function (event) {
$selectTopic = $(this);
})
The later use the jQuery object directly.
setTimeout(function () {
$selectTopic.trigger('click');
}, 1000);
If for some reason you need the selector string again to maybe query for nested elements you can use:
$($selectTopic.selector + ' #anotherElementInside');