Most of my html is data that is provided via a Jquery request. It is written to the page by inserting it into a “main” div like such:
$("#main").html(passedData);
}
The page works great, but now i’m having problems trying to add any javascript to that data that is written to the div.
Namely I have tables that are inserted into the div and I am trying to write scripts that hide certain cells when others are clicked. I’ve used http://jsfiddle.net/ to make sure that all of my JS is correct, but for some reason it seems like the JS functions don’t see that data in the div and won’t manipulate it.
Is there anything I’m missing? When writing data to a page like this do you have to do certain things to reference that data with javascript?
You have to attach event handlers to those “future” elements like this:
Read more here. Also, it would be a lot easier if you posted your actual code.