JSFiddle - React, Tailwind, and code Playground
HTML
<body>
<div id="test" style="width:auto;max-width:150px;">Testing here</div>
<div id="debug"></div>
<script>
</script>
JavaScript
(function($)
{
$.fn.removeStyle = function(style)
{
var search = new RegExp('(^|;)'+style+'[^;]+;?', 'g');
return this.each(function()
{
$(this).attr('style', function(i, style)
{
return style.replace(search, '');
});
});
};
}(jQuery));
$(function(){
$('#test').removeStyle('width');
$('#debug').text($('#test').attr("style"));
});