Ad

Is It Possible To Enter A Background Image Size With Variable?

var setSize = $('#inputSize').val();

$("#canvas").css({
  'background-size': '100px' + setSize
});
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script>
<input id="inputSize" class="form-control" type="number" value="">

Ad

Answer

Yes you can, but there is something off in your code.

better do it this way

var setSize = parseFloat($('#inputSize').val());
var size = isNaN(setSize) ? 0 : setSize;
$("#canvas").css({
  'background-size': 100 + size + 'px'
});
Ad
source: stackoverflow.com
Ad