Quantcast
Channel: Adobe Community : All Content - Edge Animate
Viewing all articles
Browse latest Browse all 9897

How to change Id of a dynamically created child element?

$
0
0

Hi,

 

I would like to change the id of the dynamically created elements in order to work easily with their later. Currently, edge automatically generate an random id like "eid_1376057792551" for each element.

 

There is my code :

 

         sym.setVariable("labels", {

                   content2: "Visiteur",

                   content3: "Exposant",

                   content4: "Organisateur",

                   content5: "Contact",

                   content6: "Connexion"

         });

 

 

 

         // Clear initial state

                              sym.getSymbol("tab").deleteSymbol();

 

 

                              // Find all large symbols in the library

                              var prefix = "content"; // content1, content2 ... content99

                              var allTabs = [];

                              var symbolDefns = sym.getComposition().symbolDefns;

                              for (var key in symbolDefns) {

                                if (symbolDefns.hasOwnProperty(key) && key.search(new RegExp(prefix+"[0-9]{1,2}"))!=-1 ) {

                                         var tab = sym.createChildSymbol( "tab", "navigation" );

                                         tab.setVariable("contentId", key);

                                         allTabs.push(tab);

                                         tab.$("btnLabel").html( sym.getVariable("labels")[key] || "" );

                                         $tabEl = tab.getSymbolElement();

                                         $tabEl.data("sym", tab);

                                         $tabEl.css({float: "left", margin: "0 -1px 15px 0"});

                                         $tabEl.click(function(evt){

                                                  var tabSym = $(evt.currentTarget).data("sym");

                                                  $.each(allTabs, function(index,item) {

                                                            if (item != tabSym) { item.stop("normal"); item.setVariable("active", false); }

                                                  });

                                                  var $content = sym.$("content").empty();

                                                  sym.createChildSymbol(tabSym.getVariable("contentId"), "content");

                                         });

                                }

                              }

 

 

      });

 

 

Thank you .


Viewing all articles
Browse latest Browse all 9897

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>