Skip to content

Instantly share code, notes, and snippets.

@alessandro-aglietti
Created March 8, 2015 14:34
Show Gist options
  • Save alessandro-aglietti/116395f873402488217b to your computer and use it in GitHub Desktop.
Save alessandro-aglietti/116395f873402488217b to your computer and use it in GitHub Desktop.
<link rel="import" href="../bower_components/polymer/polymer.html">
<script src="../js/snap.svg-min.js"></script>
<script src="../js/jquery-1.11.2.min.js"></script>
<polymer-element name="proto-element">
<template>
<div class="div2">
Source:<input type="text" id="textsrc" value="SOURCE"><br>
Destination: <input type="text" id="textdest"><br> Flight:<input
type="text" id="textplane"><br>
</div>
</template>
<script>
Polymer('proto-element',{
ready: function() {
var s = Snap(900,700);
var rec1 = s.rect(50,200,150,80);
var rec2 = s.rect(350,200,150,80);
rec1.attr({
fill: 'lightblue',
stroke: 'lightblue',
strokeOpacity: .3,
strokeWidth: 10,
id : 'id111'
});
rec2.attr({
fill: 'lightblue',
stroke: 'lightblue',
strokeOpacity: .3,
strokeWidth: 10,
id : 'id112'
});
var hackthis = this;
document.querySelector('#id111').addEventListener('click', function(e) {
var txtboxval = hackthis.$.textsrc;
alert(txtboxval.value);
});
}
});
</script>
</polymer-element>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment