i've been playing around material design lite library google launched few days ago, have questions, on how initiate (or execute?) external js when html changes using innerhtml , appendchild.
see first example here. can see, html menu within html file when first loaded menu works fine.
but in this example, html of document modified using js. however, menu not work anymore because script not executing, think.
how can resolve issue? what's better way achieve result? i'm newbie when comes javascript.
you need attach proper event listener library. change (adding componenthandler.upgradeallregistered(); after appending item) should work:
document.body.appendchild(menu); componenthandler.upgradeallregistered();
Comments
Post a Comment