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
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.
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.
When I do this
var textarea_selector="#f_id_"+res_data.image_filename;
$(textarea_selector).removeClass("kw-class");
$(textarea_selector).addClass("update-failed");
the class does not change, but if I do this
$("textarea[id*='"+res_data.image_filename+"']").removeClass("kw-class");
$("textarea[id*='"+res_data.image_filename+"']").addClass("update-done");
it works fine.
I'm not a javascript / jquery expert :-( so a basic explanation is what I would really appreciate.