Set attribute checked to checkbox if its value is not empty – javascript

Javascript successfully copies table row along with input’s value, however checkbox does not keep attribute “checked”.

Here is the part of code.

var i = 0;

$(".add-row").click(function(){
++i;
var cA = $('#cA-'+i+'').val();
var markup = '<tr>...<input type="checkbox" id="cA-'+i+'" name="cA-'+i+'" value="'+cA+'" >...</tr>'
$('table tbody tr:first').after(markup);
});

How can I set condition to keep / set attribute “checked” if input’s value is not empty?