0

It's my first time using polymer.And I wanted to import some external scripts, but it's not working...

<link rel="import" href="bower_components/polymer/polymer.html">
<dom-module id="geo-dropdown">
    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
    <script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.7.2/jquery.min.js"></script>
    <script type="text/javascript" src="http://geotree.geonames.org/jquery.rightClick.js"></script>
    <script type="text/javascript" src="http://geotree.geonames.org/jquery.scrollTo-min.js"></script>
    <script type="text/javascript" src="GeoDropdown.js"></script>

    <template>
        <!-- entry point (earth ID) -->
        <fieldset style="display:none;">
            <div id="earth" gid="6295630" class="id_6295630"></div>
        </fieldset>

        <div>
            <select id="continent" name="continent"></select>
            <select id="country" name="country"></select>
            <select id="adm1" name="adm1"></select>
            <select id="adm2" name="adm2"></select>
            <select id="adm3" name="adm3"></select>
            <select id="adm4" name="adm4"></select>
            <select id="adm5" name="adm5"></select>
            <input id="submitBtn" type="submit" value="Submit" onclick="getLocation();"></input>
        </div>
    </template>
    <script>
        Polymer({
            is: "geo-dropdown"
        });
    </script>
</dom-module>

Can someone help me? I believe that I'm making a stupid error, but I can't find it.

Ben Thomas
  • 3,180
  • 2
  • 20
  • 38
Leonardo Coelho
  • 175
  • 2
  • 10
  • I think it´s a possible duplicate of http://stackoverflow.com/questions/22135095/polymer-element-with-javascript-dependencies – Mario Levrero Jul 15 '15 at 11:23
  • 2
    what does the browsers console say -- do you see any errors?? – Tasos Jul 15 '15 at 19:14
  • Don't use `` for input tags. Why do you have a `meta` tag in the `dom-module`? What is in the `GeoDropdown.js` script? – coderfin Jul 15 '15 at 22:27

2 Answers2

0

Remove the type="text/javascript".

Best way would be to load the dependency from a different html through import and reuse it again when needed. Checkout marked-element to handle the scope.

sounakpal
  • 106
  • 5
  • It also didn't work. And I don't want to import the script with a different html, because I want to other programmers just call the tag without thinking of dependencies... – Leonardo Coelho Jul 15 '15 at 12:42
0

Very hard to guess what the problem is without being told the error, or at least the expected vs actual behaviour... but having said that, the old croney gazing into tea leaves in the corner of my office is murmuring something about putting <script type="text/javascript" src="GeoDropdown.js"></script> after the template tag as it refers to DOM elements that have not come into existence yet... no - she is whispering it wont work... and something about loading it dynamically from the ready property of the Polymer definition object instead... and now she has passed out. Hmph.

Billy Moon
  • 57,113
  • 24
  • 136
  • 237