To add and to remove classes with delay

To add and to remove classes with delay

Hello:

I need to do a function JQuery that, to every image he adds a class css and after a delay she is removed and then it does the same thing with the following image.

In my page html have:

<h2>Seleccione una tematica</h2>
<div id="container">
    <p:dataGrid value="#{backingTematicas.tematicas}" var="tematica" columns="4">
      <h:form enctype="multipart/form-data">
         <div id="img">
            <a href="#"> <h:graphicImage class="no-selected" value="imagen/#{tematica.img_path}"/></a>
         </div> 
      </h:form>
    </p:dataGrid>
</div>

And  tried to do the following function jQuery, that works but does it with an alone image, never happens to the following one, I suppose that I lack an each () or something for the style:

$(document).ready(function(){
  $("#img").addClass("selected");
   var delay = setTimeout(function() {
   $("#img").removeClass("selected");
    }, 2000);
}); 


I wait for his help!