I have found the solution.
The problem didn’t lie in the code itself but in the program-flow.
Everytime when I click on submit I reload the index.js
so my global var radius
got overwritten with its default value again since my page reloaded.
Therefore getRadius()
has been invoked and actually did overwrite the global val radius
but before the page has reloaded again and therefore radius
has been overwritten afterwards again with its default value.
Thanks for you help anyway!
solved JQuery val(), text() and html() all return an empty String