JSFiddle - React, Tailwind, and code Playground

HTML

<body>
    <select id="registrationMember1Type1" class="type-selector">
        <option value="yearly" selected="selected">Yearly</option>
        <option value="period">Period</option>
    </select>
    <br/>
    <br/>
    <select id="registrationMember24Type1" class="type-selector">
        <option value="yearly" selected="selected">Yearly</option>
        <option value="period">Period</option>
    </select>
</body>

JavaScript

function registrationTypeChange(selectId) {
     alert('aaa' + selectId + 'aaa'); //checking if there are any spaces
 }

 $(document).ready(function () {
     $(".type-selector").change(function (event) {
         var re = /(?:\d+)/;
         var num = event.target.id.match(re);
         registrationTypeChange(num);
     });
 });