Hello.
There is a PHP handler that replaces the HTML element when parsing with its custom one.
foreach($html->find('.hidewrap') as $value) { $value->outertext = '<div class="spoiler-wrapper"> <div class="spoiler folded"><span>'.$value->children(0)->plaintext.'</span></div> <div class="spoiler-text">'.$value->children(2)->plaintext.'</div> </div>'; }
After that, the whole thing is given through json. Actually, what's the problem. CSS applies to these elements, but the js script does not want to be executed.
$(document).ready(function() { $('.spoiler-text').hide(); $('.spoiler').click(function(){ $(this).toggleClass("folded").toggleClass("unfolded").next().slideToggle(); }); });
Thanks in advance for your reply.