I need to get the textarea value from java script file. below is my code,
On click of button in index.xml, the control should go to getPrivacy_policy() and display the privacy page.
Privacy.xml
<Alloy>
<Window id="privacyWin" title="Plan India" platform="android,ios">
<View id="header">
<Label id="title">Privacy Policy</Label>
</View>
<TextArea id="privacyID" suppressReturn="false"></TextArea>
</Window>
</Alloy>
index.js
function getPrivacy_policy()
{
var privacy_string = "some long text...";
return privacy_string;
var privacyPolicy = Alloy.createController('privacy').getView();
privacyPolicy.open();
}
How can display the privacy_string
value in textarea which is located in privacy.xml?
Note that both (XML and Js) are different files.
In Alloy you can access the view elements by their ID, so you can do:
$.privacyID.value
which will return the text inside the TextArea