I make a $.get
call to my db and it returns some HTML (data
):
$.get(url, null, function(data) {
The HTML it returns is something like this:
<div id="1234" class="myclass">..more html..</div>
In my callback function, I try to add a class to it (based on some conditionals that I have tested are successfully being reached) like so:
if (someCondition) $(data).addClass('mynewclass' + someId);
Even when someCondition
is true, my HTML is not having the mynewclass[someId]
class added to it. Is there any reason why this may be that I'm just stupidly overlooking?
Thanks... :\
EDIT
Here's a link to a reproducible example. It's not EXACTLY what i'm doing per se (i'm not using a var outside to get my data, but i'm reproducing the same effect). notice how it's showing 'false' for the test.