JSFiddle - React, Tailwind, and code Playground

HTML

<input type="text" name="width" value="" id="width" />
<input type="text" name="height" value="" id="height" />
<br />
<br />
<img src="http://static.elderscrollsonline.com/assets/img/cms/media/blogs/ae63764bd2490144473b4d1d251cb078.jpg" id="img" />

JavaScript

$(function() {
    $('#width, #height').keyup(function() {
        var width = $('#width').val();
        var height = $('#height').val();

        if (width < 300 && height <= 500) {
            $('#img').css({
                "width" : width + 'px',
                "height": height + 'px'
            });
        }
    });
});