Apperyio(id)
Apperyio ('component_name') is a shortcut to get a reference to a jQuery Mobile component on a screen by using its designated name. component_name is the name you set in Name property (in the PROPERTIES panel).
jQuery API
It’s important to familiarize yourself with the jQuery and jQuery Mobile API.
Once you get a reference to an element, you can use the jQuery API to manipulate the element. It is a plain JavaScript and jQuery.
Here is example reading the input field value when clicking a button:
- Add a Click event to the button.
- Add a Run Custom Java Script action to the Click event.
- Add this JavaScript as the custom JavaScript (assuming the Input component name is Input).
var input = Apperyio('input');
alert (input.val());
Example
The example above is a quick and easy way to get access to any component in the screen. It’s equivalent to using jQuery directly:
var input = $('input[dsid="input"]');
alert (input.val());
Once you get a reference to a component, which part of the jQuery API is available depends on the component. For example, if you get a reference to an Input component, then you could use this to read or set its value:
Apperyio('input').val();
Apperyio('input').val('hello');
Example
If you get a reference to a Label component, then the API is different, and to read the value, you would use:
Apperyio('output').text();