I have a div with an attribute of "foldername" which can something like "shoes, "dresses," etc . The div looks like this:
<div id='folder_template' class="openclosed_folder_icon subfolder" foldername="shoes">
<img class="folder_icon" src="images/folder_closed.png" />
<div class="folder_label">name</div>
</div>
I want to search for the div that has a particular value for foldername and change the image in it from "folder_closed.png" to "folder_open.png," so the graphic looks like an open folder instead of a closed folder. So I have the code:
$("div[foldername=g.currentGallery]").attr('src','images/folder_open.png');
where g.currentGallery is a variable holding the gallery name, e.g., "shoes," that I want to change. But this line gives me the error:
Syntax error, unrecognized expression: div[foldername=g.currentGallery]
But it will take:
$("div[foldername='shoes']").attr('src','images/folder_open.png');
Why can't I use a variable here?