Dynamic Element won't work for Element Tag or Selector



I am implementing event tracking in DTM for a new feature on our site. One of the features allows visitors to create list to add items to. The element I want to use to track the event is dynamic.  One element could look like "input#87234.mylists-single-option" and another one could like like "input#0235.mylists-single-option". How do I implement a dynamic element? I assume I will need custom code. What does the custom code look like?


Thank you,