Im getting a response with a bunch of elements from the server, each has one of three classes. I want to append each into different containers depending on what class they have, but I’m not successful. Can anyone help me?
The code seems right. What happens differently when you run this code? Are all elements being appended to the element with id of three? Maybe try removing the dot from .hasClass('.one') and .hasClass(.two). Classes in Javascript are written without the dot so for instance that first $(this).hasClass('.one') will evaluate false even though the one class is there.
Sorry, what I said wasn’t entirely true. Some jQuery methods allow an htmlString as its parameters. Check it out: http://api.jquery.com/appendto/
htmlString is used to designate a string that represents one or more DOM elements. In that case, appendTo('#one') uses #one to select the DOM element with such ID.