JSFiddle - React, Tailwind, and code Playground

HTML

<div>test</div>

CSS

div{
    background: red;
    position: absolute;
}

JavaScript

var myString = "px";
    var myMethod = function(){
        if(myString=='percent'){
        return '%';
    } else {
        return myString; // should return 'px'
    }
        $('div').css('width','200'+myMethod()); //not working