Hello. There is a table that is dynamically filled with ajax.

jQuery works with elements that were on the page at the time of initialization of the code. If new elements are added - with ajax or functions like append () - then the events do not affect them.

Question: what event should I use for $ ('body'). On () to select the cells I need (by class, by id, whatever) for later processing?

Briefly about what exactly I want to receive, then in each row of the table in one of the cells there is a date / time, and in another cell of the same row of the table I need to insert a countdown timer to see the remaining time (later I will remove the date, only timer).

All the examples found use the click event, in my case no clicks are assumed.

    1 answer 1

    After you added items from the ajax response. can make a sample. Tagging new data with some class. and after you make the necessary operations, remove the class.

    • in the answer ajax is the ready html-code of the table body, I already tried to parse it, but somehow hemorrhoid ... I already added classes to the cells in the php-script, where ajax addresses, but after $ ('#' + tableName) .html (tableBody) elements with these classes are not available. - Mortgoroth
    • Do you insert your table in html? - Tsyklop
    • yes, by id tbody - Mortgoroth
    • <table id = "extQuarTab" class = "simpleTab"> <thead> </ thead> <tbody id = "qumh"> </ tbody> </ table> - Mortgoroth
    • You did not understand. Do you insert at the right place with $('div').html(response.table) ? - Tsyklop