Under review

basic javascript

Anthony DeFilippo 10 years ago updated by Alexander Blach (Developer) 10 years ago 4
Hi, great app (I think) but I'm having a lot of trouble even getting javascript to be recognzied at all...

I'm a 'somewhat beginner' but I can't even get a simple alert to show up in the preview window.

any examples of code that you know works that will get a simple 'alert' to popup?
For example, the below code doesn't work...any ideas? Seems too basic to not work.


<!DOCTYPE html>

<p>Click the button to display an alert box:</p>

<button onclick="myFunction()">Try it</button>

function myFunction() {
alert("I am an alert box!");

Under review
The example works on my iPad. Just ignore the "ubiquitouspreview://null" title - it's a result of how the preview in Textastic works.

Here is a screenshot of the alert:

Thanks for the quick reply!  Couple questions:

- did you just copy paste my code above into an 'html 5' page?
- i'm using an iPas air (OS 7.1.2), any issue with this version and your version of Textastic?
- are there any setting I need to have turned on / be aware of for this to work?

I still just get a blank page w/ nothing...

Vielen Dank für die Hilfe!
Yes, I just copied and pasted your code into a new HTML file. I am using the same iOS version and the latest version of Textastic. 

Then I pressed the preview/glasses button.