copy data
I would like to grab information from a select menu, make some calculation based on this and present the result in a label. For some reason I failed totaly and wonder if someone could provide some help?
Sincerely
Max
Catch up wih the Appery.io community on our forum. Here you'll find information on the lastest questions and issues Appery.io developers are discussing.
https://forum.appery.io/
I would like to grab information from a select menu, make some calculation based on this and present the result in a label. For some reason I failed totaly and wonder if someone could provide some help?
Sincerely
Max
Please tell us what you tried (code, etc) and what didn't work.
I tried something like this
function(calculatekanaldim);
and a function calculatekanaldim containing
var input = Tiggr('kanaldiameter');
input = input/2;
Tiggr('tryckfall').text('input')
where kanaldiameter is the name of the select and tryckfall is the label.
Sincerely,
Max
Tiggzi(id) gives you a jQuery Mobile component, you then need to either use .text() or .val(), depending on the component to get the actual value.
I tried something very simple like
Tiggzi('tryckfall').text("hello")
but the text is not changed, any ideas?
/Max
Hello! Try this code:
codeTiggzi('tryckfall').val("hello")/code
Thanks, That worked fine but when I run the code within a javascript nothing happens. I try to run the script by
calculate();
Any ideas?
/Max
I don't understand what didn't work... you have to debug your JavaScript. Put console.log(..) statements and see what you get. Are you selecting the right jQuery Element in the DOM?
To read a value from a select menu, you would do this:
var value = Tiggzi('id').val();
where 'id' is the name of the select menu. To assign that value to a label:
Tiggzi('label_id').text(value);