조건이 참일 때 두 가지 결과를 내고 싶습니다. 그래서 작은 함수를 만들었지 만, condtion이 ture 일 때 첫 번째 결과 만 나타나고 있습니다. src와 pixel이 비어있을 때 이미지 프레임을 표시하고 높이와 너비를 공백으로두면 높이와 너비를 1 픽셀로 설정하므로 높이와 너비 속성을 설정합니다.jquery if conditon?
$(function() {
if ($('img.offerProduct').attr('src') == false) {
$('.offerProduct').removeClass('offerProduct');
$('.offerProduct').attr({width:'0', height:'0'})
}
}
)
<body>
<img src="" width="60" height="60" class="offerProduct" />
</body>