How to select an image having particular 'alt' attribute using jquery
<p>I have the below html in my page .</p>

<pre><code>&lt;div id="bb-bookblock" class="bb-bookblock bb-vertical" style="height: 578.24885475px"&gt;
    &lt;div class="bb-item" style="display: none;"&gt;
        &lt;a href="#"&gt;
            &lt;img src="photorepository/admin/a-123/14/31 copy_200comp.jpg" alt="31 copy_200comp.jpg" style="height:100%"&gt;
        &lt;/a&gt;
    &lt;/div&gt;
    &lt;div class="bb-item" style="display: none;"&gt;
        &lt;a href="#"&gt;&lt;img src="photorepository/admin/a-123/14/32 copy_200comp.jpg" alt="32 copy_200comp.jpg" style="height:100%"&gt;&lt;/a&gt;
    &lt;/div&gt;
    &lt;div class="bb-item" style="display: none;"&gt;
        &lt;a href="#"&gt;&lt;img src="photorepository/admin/a-123/14/4 copy_200comp.jpg" alt="4 copy_200comp.jpg" style="height:100%"&gt;&lt;/a&gt;
    &lt;/div&gt;
    &lt;div class="bb-item" style="display: none;"&gt;
        &lt;a href="#"&gt;&lt;img src="photorepository/admin/a-123/14/5 copy_200comp.jpg" alt="5 copy_200comp.jpg" style="height:100%"&gt;&lt;/a&gt;
    &lt;/div&gt;
&lt;/div&gt;
</code></pre>

<p>I need to turn <code>style="display: block;"</code> of the div having class <code>bb-item</code> of the image having a particular <code>alt</code>. For example  if the <code>alt</code> is <code>'5 copy_200comp.jpg'</code>, then the parent div of that particular image turns like this:</p>

<pre><code>&lt;div class="bb-item" style="display: block;"&gt; &lt;a href="#"&gt;&lt;img src="photorepository/admin/a-123/14/5 copy_200comp.jpg" alt="5 copy_200comp.jpg" style="height:100%"&gt;&lt;/a&gt;&lt;/div&gt;
</code></pre>

<p>I tried <code>var src = $('img[alt="example"]')</code> and similar constructs but they aren't working.</p>