DOM class injection in PHP
Posted
by Adam Kiss
on Stack Overflow
See other posts from Stack Overflow
or by Adam Kiss
Published on 2010-03-12T13:24:56Z
Indexed on
2010/03/12
13:27 UTC
Read the original article
Hit count: 235
idea
Via jQuery, I was able to mark all :first-child
and :last-child
elements in document (well, almost all :)) with class first
which could I later style (i.e. first li in ul#navigation
would be easily adressable as ul#navigation .first
).
I used following code:
var $f = $('*:first-child')
$f.addClass('first');
var $l = $('body *:last-child')
$l.addClass('last');
question
Now, my question is if it's possible to do the same via php
, so non-JS users/gadgets could have the same effects and additional styling and also it would be less overkill on browser.
So, is it possible to capture output, parse it as html and inject this class easily in php
?
© Stack Overflow or respective owner