jQuery if statement problem
<p>i am trying to change image in the div if the user click on any span,if div already contains roz variable(which comes from the index page) then by clickng on the span, img roz should not be appneded but it does not work.</p>

<p>i am not sure if the first part of IF statement in jQuery is right </p>

<p>here is html part</p>

<pre><code>&lt;div class="iconWrapper"&gt;
&lt;ul class="color"&gt;
&lt;li&gt;&lt;a href="#" title="Selecteer"&gt;&lt;span class="color1"&gt;&lt;/span&gt;&lt;/a&gt; &lt;/li&gt;
&lt;li&gt;&lt;a href="#" title="Selecteer "&gt;&lt;span class="color2" &gt;&lt;/span&gt;&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="#" title="Selecteer"&gt;&lt;span class="color3"&gt;&lt;/span&gt;&lt;/a&gt; &lt;/l&gt;
&lt;li&gt;&lt;a href="#" title="Selecteer"&gt;&lt;span class="color4"&gt;&lt;/span&gt;&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt; &lt;/div&gt;

&lt;div id="div1" &gt; &lt;?php if(isset($_SESSION['img'])){
echo '&lt;img src="' . $_SESSION['img'] . '" &gt;' ; }
?&gt;
&lt;form method="post" action="weekDays.php"&gt;
&lt;input name="kleur" type="text" value="" id="hiddencolor" /&gt;

&lt;input name="submit" type="submit" value="Submit" /&gt;
&lt;/form&gt; &lt;/div&gt;
</code></pre>

<p>jQuery:</p>

<pre><code>$(function(){
    var roz='../../photo/roz1.jpg';

    $('.iconWrapper span').click(function(e){
        var kleur=$(this).attr('class');
    if($('#div1').attr('src' == roz)){
        $('#div1' ).children('img').remove() ;
        $('#div1'). append('&lt;img src="img/300.jpg" /&gt;');
    }else{
       $('#div1').children('img').remove();
       $('#div1').append('&lt;img src="img/106.jpg" /&gt;');
    }
    e.preventDefault(); 
    alert(  $('#div1').html()  );       
});
</code></pre>

<p>});

