JSFiddle - React, Tailwind, and code Playground

HTML

<select name="moduleGroup">
    <option data-function="getListing('pages')">Pages</option>
</select>

JavaScript

function getListing(s) {
    //console.log(s);
    alert(s);
}
    
function getPages() { 
    this.getListing('pages');
}

$('select').on('change', function() {
    var func = $(this).find('option:selected').attr('data-function');
    eval(func);
});

// To aid in debugging: just so we don't have to 
// manually select each time we re-run the jsfiddle
$('select').trigger('change');