Jump to content

please help me with this jquery code


linux1880

Recommended Posts

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

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.