The fragment logic of JS fragments cannot influence the IDs of controls that are created in the createContent() method.
This behavior is similar to JS view's behaviour regarding IDs. When a static ID is given within a JS fragment, the this.createId() method should be used:
createContent: function(oController ) { var oButton = new sap.ui.commons.Button(this.createId("btnInJsFragment"), { // use createId() to let the fragment influence the ID text: "Hello JS World" }); return oButton ; }
If an ID is given when the fragment is instantiated, createId() will add it as prefix. Else, createId() will leave the given ID untouched. It is, however, possible that a containing view may add its prefix.