JSFiddle - React, Tailwind, and code Playground

HTML

<div class="menu">hai</div>

JavaScript

$.fn.doMobile = function (someFunction) {
    someFunction.call(this);
};

$('.menu').doMobile(test);

function test(elem) {
    $(this).css('background-color', 'red');
    alert("came");
}