How can I create an XML element from Javascript


#1

Is there any way to create an XML element from Javascript? For example,when I tap the button,It will create 5 text fields in the page.


#2

Yes, you can. Simply do this in the click event.

var TextField = require('ui/text-field').TextField;
....
....
var textField = new TextField();
// Assign any property if required
textField.hint = "Something";
// `yourLayout ` must be reference to your parent layout which is going to hold the textfield
yourLayout.addChild(textField);