CMTV
Well-known member
Hi!
In general, I need to analyze the DOM every time it is changed and maybe add some classes to inserted elements.
In particular, I am trying to get a preview element which appears after clicking on "Preview" button.
After researching the code for some time I figured out that I need to listen for
So here is my example code:
The problem is that I get nothing (length === 0). This happens only with "Preview" cases and works for all other inserted elements (tabs, menus, member profile panes) works fine...
It is even more strange that
In general, I need to analyze the DOM every time it is changed and maybe add some classes to inserted elements.
In particular, I am trying to get a preview element which appears after clicking on "Preview" button.
After researching the code for some time I figured out that I need to listen for
xf:reinit
event since it is called every time after XF.setupHtmlInsert
function is successfully finished.So here is my example code:
JavaScript:
(function ($, document)
{
$(document).on('xf:reinit', function (a, el)
{
console.log($('.bbCodePreview-content'));
});
})
(jQuery, document);
The problem is that I get nothing (length === 0). This happens only with "Preview" cases and works for all other inserted elements (tabs, menus, member profile panes) works fine...
It is even more strange that
el
variable is an added element. But why the hell it can't find it with $('.bbCodePreview-content')
?!
Last edited: