title: jQuery click with changing .text value
body: <p>I've got a slider on my main page that displays a picture and some text. After a few seconds, the picture changes and so does the text.</p>
  
  <p>What I want to do is that when someone clicks on the text, it goes to the corresponding page.</p>
  
  <p>For example: If the text is Chocolate, go to chocolate.php. Else if it's Vanilla, go to vanilla.php</p>
  
  <p>However, with my current code, it always goes to chocolate.php no matter what the text says.</p>
  
  <pre><code>   walk:function(step) {
       $('#type').text(type_value[step]).on('click', function(){
            var selection = $('type').text(type_value[step]).value;
              if(selection = 'Chocolate') {
                  window.location = 'selection/chocolate/';
                  return false;
                  } else if (selection = 'Vanilla') {
                  window.location = 'selection/vanilla/';
                  return false;
                  }
              });
            }
  </code></pre>
  
  <p>I've also tried:</p>
  
  <pre><code> walk:function(step) {
     $('#type').text(type_value[step]).click(function(){
        var selection = $('#type').text(type_value[step]).value;
          if(selection = 'Chocolate') {
              window.location = 'selection/chocolate/';
              return false;
          } else if (selection = 'Vanilla') {
              window.location = 'selection/vanilla/';
              return false;
              }
          });
  </code></pre>
  
  <p>Another thing I tried was without using var selection. Checking value directly in if statement instead.</p>
  
  <p>Please let me know if you are confused by something, and I will be more than happy to clarify.</p>
  
  <p>Thank you very much for your time, and for your help.</p>