I am writing a code to add two number and display the result on another page. But I am not getting the desired output.
addbtn=button id add=result page id calc= starting page id....here is my code:
// Bind to 'page init' event for our data page
$(document).delegate('#calc', 'pageinit', function() {
// Do some processing when the button with id 'addbtn' is clicked ( or tapped )
$('#addbtn').click(function() {
// Read the values
var num1 = $("#num1").val(), num2 = $("#num2").val();
var add = parseInt(num1) + parseInt(num2) ;
$add = $('#add');
// Clear the value if value isn't proper
if (add == '0.000' || add == 'Infinity' || add == 'Na N') {
add = '';
}
// Get to the DOM node that has the actual text
while ($add.children().length) {
$add = $add.children().first();
}
// Set it to the calculated value
$("#add").text(add);
});
});