Note that there are some explanatory texts on larger screens.

plurals
  1. POjavascript in phonegap for single page application
    primarykey
    data
    text
    <p>I try to convert my web application into Android application, using Phonegap.</p> <p>The application is very simple: html, javascript, css. Logically it is a single page, which content is changed by a simple javascript code (no any external libraries). </p> <p>The problem is that, javascript works only for items present on the original page. If an item appeared as a result of a javascript function and has another javascript function assigned to it, that another function never be executed. </p> <p>What could be the reason? And how can I improve the situation? </p> <p><strong>Update:</strong></p> <p>the problem is that in case one see the app in a desktop browser window form1 property of the document is defined (it appears on step3), for a mobile app it is not so.<br> Demo:</p> <pre><code>&lt;html&gt; &lt;head&gt; &lt;script type="text/javascript"&gt; document.onclick = function( whichOne ){ whichOne = whichOne ? whichOne : window.event; thisButton = whichOne.target ? whichOne.target : whichOne.srcElement; if (thisButton.name) { if (thisButton.value == 'Submit') { if (undefined != document.form1){ alert("yes form1"); } else { alert("no form1"); } } else if (thisButton.name == 'b1') { var iner ='&lt;center&gt;step 2&lt;/center&gt;'; un1(thisButton.title,iner); var oid=thisButton.title; iner = t4a(oid,thisButton.name); setTimeout( function() { un1(oid,iner);},1000); } } } function un1(id,iner){ var ele = document.getElementById(id); ele.innerHTML = iner; } function t4a (id,ara){ var i; var out="&lt;form name='form1'&gt;&lt;center&gt;step 3&lt;table border='1'&gt;"; for (i=0;i &lt; 2;i++){ out +="&lt;tr&gt;&lt;td align='left'&gt;"+i+".&lt;/td&gt;&lt;td align='right'&gt;&lt;input type='text' name='f"+i+"'&gt;&lt;/td&gt;&lt;/tr&gt;"; } out+="&lt;/table&gt;&lt;input type='button' name='a"+ara+"' title='"+id+"' value='Submit' &gt;&lt;/center&gt;&lt;/form&gt;"; return out; } &lt;/script&gt; &lt;/head&gt; &lt;body&gt; &lt;center&gt; &lt;form &gt; &lt;div id ="b1"&gt; &lt;input type="button" name="b1" title="b1" value="Butt"&gt; &lt;/div&gt; &lt;/form&gt; &lt;/center&gt; &lt;/body&gt; &lt;/html&gt; </code></pre>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload