You can use the querySelector for that:
document.querySelector('[id^="poll-"]').id;
The selector means: get an element where the attribute [id]
begins with the string "poll-"
.
^
matches the start
*
matches any position
$
matches the end