linux1880 Posted April 26, 2011 Share Posted April 26, 2011 i am trying to display result in div but no luck, while it works on alert, pls help <html> <head> <script src="jquery.min.js"></script> </head> <body> <script> $(document).ready(function(){ $("#form1").submit(function(){ var a = parseInt($("#in1").val()); var b = parseInt($("#in2").val()); var total = a+b; $("#total").append("<p>+total+</p>") }); }); </script> <form id="form1"> num1 <input type="text" id="in1" size=5 /> + num2 <input type="text" id="in2" size=5 /> <input type="submit"> </form> <div id="total"></div> </body> </html> Link to comment https://forums.phpfreaks.com/topic/234743-please-help-me-with-this-jquery-code/ Share on other sites More sharing options...
JonnoTheDev Posted April 26, 2011 Share Posted April 26, 2011 $(document).ready(function(){ $("#form1").submit(function(){ var a = parseInt($("#in1").val()); var b = parseInt($("#in2").val()); var total = a+b; $("#total").append("<p>"+total+"</p>") return false; }); }); Link to comment https://forums.phpfreaks.com/topic/234743-please-help-me-with-this-jquery-code/#findComment-1206384 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.