Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    text
    copied!<p>Of course it is working in a jsFiddle example, you didn't include jQuery Mobile. As soon as you initialize it everything brakes.</p> <p>To understand why you need to understand how jQuery Mobile styles its form elements. When jQuery Mobile style its content it hides everything and create new custom widget elements. This is why your code is not working any more. Input elements are still there but their structure path is different.</p> <p>This example will work in your Phonegap app: <a href="http://jsfiddle.net/Gajotres/MygJC/6/" rel="nofollow">http://jsfiddle.net/Gajotres/MygJC/6/</a></p> <pre><code>$('div#cont-sum-fields').on('change', 'input', function() { var total = 0; $('#cont-sum-fields').find('input[id^="cont-sum"]').each(function() { if ($(this).val() !== "") total += parseFloat($(this).val()) }); $('#cont-sum-fields').find('#total-cont-sum').val(total); }); </code></pre> <p>This is how your page looks like when jQuery Mobile restyle it:</p> <pre><code>&lt;div id="cont-sum-fields"&gt; &lt;div class="ui-input-text ui-shadow-inset ui-corner-all ui-btn-shadow ui-body-c"&gt; &lt;input type="number" id="cont-sum-1" class="ui-input-text ui-body-c"/&gt; &lt;/div&gt; &lt;div class="ui-input-text ui-shadow-inset ui-corner-all ui-btn-shadow ui-body-c"&gt; &lt;input type="number" id="cont-sum-2" class="ui-input-text ui-body-c"/&gt; &lt;/div&gt; &lt;div class="ui-input-text ui-shadow-inset ui-corner-all ui-btn-shadow ui-body-c"&gt; &lt;input type="number" id="cont-sum-3" class="ui-input-text ui-body-c"/&gt; &lt;/div&gt; &lt;div class="ui-input-text ui-shadow-inset ui-corner-all ui-btn-shadow ui-body-c ui-disabled"&gt; &lt;input type="number" disabled="disabled" id="total-cont-sum" class="ui-input-text ui-body-c mobile-textinput-disabled ui-state-disabled" aria-disabled="true"/&gt; &lt;/div&gt; &lt;/div&gt; </code></pre>
 

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