If P tag is display:none; Javascript
<p>I have the following...</p>

<pre><code> $(document).ready(function() {
        $('p:contains("You")').parent('span').prev('input').addClass('error');
  });
</code></pre>

<p>My function works fine given that it adds the class to the correct inputs but it should only add the class if the paragraph containing 'you' is display:inline. </p>

<p>Has anybody any idea of how I can do this? </p>

<hr>

<p>My markup for each input is similar to this....</p>

<pre><code>&lt;li class="yourdetli"&gt;
    &lt;label class="yourdet"&gt;House Number&lt;/label&gt;
    &lt;input type="text" id="ctl00_ContentPlaceHolder1_TB_HNumber2" name="ctl00$ContentPlaceHolder1$TB_HNumber2"&gt;
    &lt;span style="color: Red; display: none;" class="errorp" id="ctl00_ContentPlaceHolder1_RequiredFieldValidator9"&gt;
        &lt;p&gt;You must complete this field&lt;/p&gt;
    &lt;/span&gt;
 &lt;/li&gt;
</code></pre>
