Software Archive
Read-only legacy content
17061 Discussions

[1826] code placed in index_user_scripts.js disappearing

Nello_C_
Beginner
372 Views

Given this scenario:

- I have created a custom script and linked it to a button.
I have multiple "pages" within the same page
- I link the button to the custom script.

When I go to "emulate" the script, it works flawlessly. The moment I click back on index.html and click on "Design", the button will be automatically linked to another "sub page". At this moment - the script is still present. When I click to re-link the button to the script, it deletes whatever is there presenting a blank function.

The best would be NOT to touch at all any code and leave the developer in charge to delete the code if necessary. It makes the app useless.

 

Same behavior shown on OS X and Win 7

0 Kudos
1 Reply
PaulF_IntelCorp
Employee
372 Views

I recommend you don't insert JS into the tags that App Designer is creating. Instead, use something like addEventListener to locate an item in your JS file and attach that way. It's much easier to debug your app if you do not put JS in the HTML tags, keep it in JS only files. An example of what I mean can be found in this simple test app > https://github.com/xmnboy/hello-cordova (see the init-app.js file).

Within App Designer there is a properties page where you can assign an ID without having to go inside the index.html file.

0 Kudos
Reply