Fortunately the solution is quite simple, for example in this case:
document.getElementById('cartAddSpecContent').innerHTML = spec;
All you have to do is to replace the 'cart'AddSpecContent' element (that used to be a
<p>
) for a block-level one like
<div>
and that's it ;)