javascript - Getting an attribute from the same html file I am working on -


i creating plugin template. after publishing template web, there attribute inside inserted script need value , use in plugin.

is there way js/jquery?

here part of page in attribute located:

platform.utils.initwidget('#skyline', function (elem) {      new website.tool.constantin(elem, {         event: 'click',         transitionduration: 93000     });  }); 

i need find way search html , value transitionduration i.e 93000.

additional comment:

this code generated template , have no control on changing how formed. inspected html, , template places code js code ( "the code" ) somewhere in body. assumed there might way plugin making able read html, find attribute , use same transition duration html defines on elements.

after re-reading , seeing comments, assume template inserts script somewhere , want @ transitionduration plugin.

as in

    var scripts = document.getelementsbytagname("script"), duration=0;      (var i=0;i<scripts.length;i++) {        var text = scripts[i].textcontent;        if (text.indexof("transitionduration") !=-1) {           duration = parseint(text.split("transitionduration:")[1],10);          break;        }      }      alert(duration);
    <script>      platform.utils.initwidget('#skyline', function (elem) {         new website.tool.constantin(elem, {          event: 'click',          transitionduration: 93000        });       });      </script>


Comments

Popular posts from this blog

c - Bitwise operation with (signed) enum value -

xslt - Unnest parent nodes by child node -

YouTubePlayerFragment cannot be cast to android.support.v4.app.Fragment -