DOM id and name for lightbox elements

Suggestion: Elements (like ) created in the lightbox sections should have DOM ids and/or names associated with them, so that custom JavaScript code can find and access those elements.

Hello,

That depends on what you want to do with the section. Most likely you will want something advanced and it’s more easily done with the completely custom section.

But still there is a way to get section. When lightbox is generated initial section configuration is updated with ‘id’ property which points to the header of each section. So you can jump to this header -> nextSibling -> getElementsByTagName(‘select’)[0] for example.

Let’s say we want to access select with the section name “custom_select”:

var req_section; var sections = this.config.lightbox.sections; // got list of all sections for (var i = 0; i < sections.length; i++) { if(sections[i].name == "custom_select"){ // found required section req_section = sections[i]; break; } } var req_node = document.getElementById(req_section.id).nextSibling; // for each section unique id is generated for section's header, so we are finding it and jumping to nextSibling - section with select on it var req_select = req_node.getElementsByTagName('select')[0]; // in this section there is just one select so we are finding and storing it
Kind regards,
Ilya