Reputation: 1654
If my image doesnt contain a src then i want to hide it using visibility hidden:
<img border="0" src="" style="cursor:hand;cursor:pointer;" id="EntityPic543">
How can i do this with jquery?
Upvotes: 0
Views: 2893
Reputation: 6042
$(document).ready(function(){
$("img").each(function(){
(!this.src || $(this).prop("src")) && $(this).hide();
});
});
Thanks to @GeorgeMauer
Upvotes: 2
Reputation: 231
$("#EntityPic543").css("visibility", "hidden");
That will hide the element.
Upvotes: 0
Reputation: 6668
$('img').filter(function(index){return $(this).attr('src')==='';}).hide();
Upvotes: 4