title: Can't change the text inside a span using Jquery if else
body: <p>I'm trying to change the text of a <code>span</code> when it is clicked depending on the current value it has. </p>
  
  <p>If it is Open  - then set value to Close. </p>
  
  <p>If it is Close - then set value to Open.</p>
  
  <pre><code>$('.details_btn').click(function(){
      if($(this).text('Open'){
          $(this).html('Close');
      }else{
          $(this).html('Open');   
      }
  });
  </code></pre>
  
  <p>I've got a fiddle of what I've been doing here:</p>
  
  <p><a href="http://jsfiddle.net/javacadabra/ch0u1xws/" rel="nofollow">http://jsfiddle.net/javacadabra/ch0u1xws/</a></p>
  
  <p>However, it doesn't seem to ever go back from Close to Open and I'm not sure why. Could someone shed some light on this? </p>
  
  <p>Many thanks</p>