Распознавайте новые элементы, добавленные в DOM после запроса AJAX. ⇐ Jquery
-
Гость
Распознавайте новые элементы, добавленные в DOM после запроса AJAX.
I am trying to display a new div element added to the DOM via AJAX.
So, via AJAX/PHP I added dynamically some new buttons
View And also added dynamically some new hidden divs
In my main page I have a JS function (before the $(document).ready) to show/hide the div
function viewPP(i){ var obj = "viewPP_"+i; document.getElementById(obj).style.display = "block"; //$(obj).toggle(); } If I use document.getElementBy... , nothing happens. (no error, just do nothing)
If I use $(obj), nothing happens (no error, just do nothing)
I can understand new elements added to the DOM after the page is loaded are not recognized by JQuery, but can't find the way to make it work.
How can I do that??
Источник: https://stackoverflow.com/questions/656 ... ax-request
I am trying to display a new div element added to the DOM via AJAX.
So, via AJAX/PHP I added dynamically some new buttons
View And also added dynamically some new hidden divs
In my main page I have a JS function (before the $(document).ready) to show/hide the div
function viewPP(i){ var obj = "viewPP_"+i; document.getElementById(obj).style.display = "block"; //$(obj).toggle(); } If I use document.getElementBy... , nothing happens. (no error, just do nothing)
If I use $(obj), nothing happens (no error, just do nothing)
I can understand new elements added to the DOM after the page is loaded are not recognized by JQuery, but can't find the way to make it work.
How can I do that??
Источник: https://stackoverflow.com/questions/656 ... ax-request
Мобильная версия