Can someone give me idea of doing this in JS?

Can someone give me idea of doing this in JS?

I have HTML, and I want to parse the images to show the lightbox/jquery Pop-Up Effect, without pre-adding any rel=“lightbox” or something like that.

But want to show the effect, how can I do this using JavaScript or somethign else like PHP?


Javascript is the only way to make modal/popup windows as PHP is just a raw code engine and doesn’t have any power over real time DOM updates. What your wanting to attempt im pretty sure can’t be done without appending an event to every element that needs to activate a popup but another method would be to use an anchor argument within the href attribute such as…

<a href=";lightbox">Some Link</a>

then using a JS loop find all the elements that have that specific inline argument but that’s a lot of extra work to do just for something you can easily do using rel=“lytebox”.

Thanks Sir.
I found a wordpress plugin (Lightbox Plus) is doing it, that it gets HTML and parses it to convert images into Popable.

But I don’t know how to do it on my own PHP code, because my code is not wordress based… It is self-written…

Lightbox Plus still uses the rel attribute so there’s nothing different compared to using it and colorbox alone.