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