I'm trying to add css properties to an image that is set to a variable:
<script>
var img = '<img src="../common/img/check-mark.png">';
var imgCheck = img.css({'border':'1px solid red'});
$(function(){
$('.content li').before(imgCheck);
});
</script>
The image shows up without the css properties:
<script>
var img = '<img src="../common/img/check-mark.png">';
$(function(){
$('.content li').before(img);
});
</script>
If I add the css properties after the .before, it applies the css to the whole li.
<script>
var img = '<img src="../common/img/check-mark.png">';
$(function(){
$('.content li').before(img).css({'border':'1px solid red'});
});
</script>