Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    text
    copied!<p>Please try below code.It's displaying the result in the final page. </p> <pre><code>&lt;!DOCTYPE html&gt; &lt;html&gt; &lt;head&gt; &lt;title&gt;Page Title&lt;/title&gt; &lt;meta name="viewport" content="width=device-width, initial-scale=1"&gt; &lt;link rel="stylesheet" href="http://code.jquery.com/mobile/1.2.0/jquery.mobile-1.2.0.min.css" /&gt; &lt;script src="http://code.jquery.com/jquery-1.8.2.min.js"&gt;&lt;/script&gt; &lt;script src="http://code.jquery.com/mobile/1.2.0/jquery.mobile-1.2.0.min.js"&gt;&lt;/script&gt; &lt;script&gt; function sum() { var item1num = document.getElementById('item1num').value; var item2num = document.getElementById('item2num').value; {result = parseInt(item1num)*parseInt(item2num); document.getElementById("showResult").innerHTML = "Result is: "+(result);} } &lt;/script&gt; &lt;/head&gt; &lt;body&gt; &lt;!-- Home --&gt; &lt;div data-role="page" id="page1"&gt; &lt;div data-role="content"&gt; &lt;div data-role="fieldcontain" id="item1"&gt; &lt;fieldset data-role="controlgroup"&gt; &lt;label for="item1"&gt; item1 &lt;/label&gt; &lt;input name="item1num" id="item1num" placeholder="" value="" type="number" /&gt; &lt;/fieldset&gt; &lt;/div&gt; &lt;a data-role="button" data-transition="slidefade" href="#page2" data-theme="b"&gt; Next &lt;/a&gt; &lt;/div&gt; &lt;/div&gt; &lt;div data-role="page" id="page2"&gt; &lt;div data-role="content"&gt; &lt;div data-role="fieldcontain" id="item1"&gt; &lt;fieldset data-role="controlgroup"&gt; &lt;label for="item2"&gt; item2 &lt;/label&gt; &lt;input name="item2num" id="item2num" placeholder="" value="" type="number" /&gt; &lt;/fieldset&gt; &lt;/div&gt; &lt;a href="#page3" data-role="button" data-theme="b" data-transirion="slidefade" onclick="sum();"&gt;B&lt;/a&gt; &lt;/div&gt; &lt;/div&gt; &lt;div data-role="page" id="page3"&gt; &lt;div data-role="content"&gt; &lt;span id="showResult"&gt;&lt;/span&gt; &lt;/div&gt; &lt;/div&gt; &lt;/body&gt; &lt;/html&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