Two conditionals inside an if statement (jQuery)
<p>I'm trying to add an if statement which checks if the image is wider than 199px and if it hasn't got a &lt; a > parent element.
<strong>This works:</strong></p>

<pre><code>    $('div.post_body').each(function() {
    $(this).find('img').each(function () {
        var img = $(this);
            if (img.is('a') !== true) {
                img.wrap($('&lt;a/&gt;').attr('href', img.attr('src')).addClass('lightview limg'));
            }
    });
});
</code></pre>

<p><strong>This works</strong></p>

<pre><code>    $('div.post_body').each(function() {
    $(this).find('img').each(function () {
        var img = $(this);
            if (img.width() &gt; 199) {
                img.wrap($('&lt;a/&gt;').attr('href', img.attr('src')).addClass('lightview limg'));
            }
    });
});
</code></pre>

<p><em><strong>This DOESN'T work:</em></strong></p>

<pre><code>    $('div.post_body').each(function() {
    $(this).find('img').each(function () {
        var img = $(this);
            if ((img.width() &gt; 199) &amp;&amp; (img.is('a') !== true)) {
                img.wrap($('&lt;a/&gt;').attr('href', img.attr('src')).addClass('lightview limg'));
            }
    });
});
</code></pre>

<p>Can someone help please?</p>
