Last active
December 11, 2016 17:19
-
-
Save gordinmitya/6cb6e687ded623fa65b56839949ba584 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!DOCTYPE html> | |
<html> | |
<head></head> | |
<body> | |
<div id="task1"> | |
<input id="t0" type="number" value="18.5"/> | |
</div> | |
<div id="task2"> | |
<input id="t0" type="number" value="18.5"/> | |
</div> | |
<script> | |
function e(id, root){ | |
return root.querySelector("#"+id); | |
} | |
var someVal; | |
function read(root){ | |
someVal = parseFloat(e("t0", root).value); | |
} | |
function calc1(){ | |
var task = e("task1", document); //Uncaught TypeError: e is not a function(…) | |
read(task); | |
var e = function(id){return e(id, task)} | |
console.log(someVal); | |
} | |
document.addEventListener("DOMContentLoaded",calc1); | |
</script> | |
</body> | |
</html> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment