title: jquery selector in variable
body: <p>can someone explain why this jquery selector is not working, I've worked around the issue but for my sanity would like to know what I've got wrong</p>
  
  <p>I have a form with multiple textareas, each gets an id like f_id_DSC000001.JPG where the last part is a photograph number, the textarea has an onblur event that uses post to send its contents and update a database table, a json response comes back. All of that works fine, I can see the results using Firebug, there are no problems there.</p>
  
  <p>The DSC000001.JPG part of the id gets passed back in the json response as confirmation, then I want to change the class of the textarea to show the state of the update.</p>
  
  <p>When I do this</p>
  
  <pre><code>var textarea_selector="#f_id_"+res_data.image_filename;
  $(textarea_selector).removeClass("kw-class");
  $(textarea_selector).addClass("update-failed");
  </code></pre>
  
  <p>the class does not change, but if I do this</p>
  
  <pre><code>$("textarea[id*='"+res_data.image_filename+"']").removeClass("kw-class");
                    $("textarea[id*='"+res_data.image_filename+"']").addClass("update-done");
  </code></pre>
  
  <p>it works fine.</p>
  
  <p>I'm not a javascript / jquery expert :-( so a basic explanation is what I would really appreciate.</p>