Display border if image available otherwise dont display border

Hei , Following is my html code and css . I dont want to display border on picture if user has not uploaded picture in article. Now my code is not hard coded in html file and thats why image tag is also displaying for every short article .If some articles have not picture border is still showing because i have style for it. I dont want to display border if user has not uploaded any picture. How can i achieve this using jquery .Any idea.

<div class="ShortAticle">
    <div class="ShortArticlePicture">
        <a href="#"> <img alt="Title" src="/images/viewimage.aspx?id=ArticlePicture" /></a>
    </div>
    <div class="ArticleText">
        <h3>Title</h3>
    </div>
</div>

CSS:

.ShortArticlePicture img {
    border: 1px solid #cccc;
}

Answers


Try the following style, it will show border only if src attribute is present

.ShortArticlePicture img[src] {
    border: 1px solid #cccc;
}

Need Your Help

JSON data type for relational DATABASE

json nosql relational-database sqldatatypes

Can a relational database have JSON as a data-type? Or Does relational data need to have such a data type.

About UNIX Resources Network

Original, collect and organize Developers related documents, information and materials, contains jQuery, Html, CSS, MySQL, .NET, ASP.NET, SQL, objective-c, iPhone, Ruby on Rails, C, SQL Server, Ruby, Arrays, Regex, ASP.NET MVC, WPF, XML, Ajax, DataBase, and so on.