Hasan Saher

3 نقاط السمعة
عضو منذ
2

وين المشكلة بالكود يجماعة (jquery

<!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8"> <title>calculator</title> <meta name="viewport" content="width=device-width, initial-scale=1"> <script src="https://ajax.googleapis.com/ajax/libs/jquery/3.6.0/jquery.min.js"></script> </head> <body> <div class="container"> <input type="text" id="hasan" value="0"> <input type="text" id="a2" value="0"> <button id="sa" >جمع(+)</button> <button id="Subtraction">طرح(-)</button> <button id="Multiplication">ضرب(*)</button> <button id="Division">قسمة(/)</button> <button id="Reset">Reset</button> <br> <h1 id="Rrsult"> حدف:<span id="a3"></span></h1> </div> <script> $(document).ready(function(){ $('#sa').click(function(){ var x=document.getElementById("hasan").Value; var z=document.getElementById("a2").Value; var result =parseFloat(x) + parseFloat(z); document.getElementById("a3").innerHTML = ""+result.toFixed(2); }); $('#Subtraction').click(function(){ var x=document.getElementById("hasan").Value; var z=document.getElementById("a2").Value; var result =parseFloat(x) - parseFloat(z); document.getElementById("a3").innerHTML = ""+result.toFixed(2); });$('#Multiplication').click(function(){ var x=document.getElementById("hasan").Value; var z=document.getElementById("a2").Value; var result =parseFloat(x)*
1

الكود ما بيطلع نتيجة معي شو الحل يجماعة ب جافا سكربت

<!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8"> <meta http-equiv="X-UA-Compatible" content="IE=edge"> <meta name="viewport" content="width=device-width, initial-scale=1.0"> <title>java script</title> </head> <body> <script> function calc () { var n1 = parseFloat(document.getElementById ( 'n1' ) . value); var n2 = parseFloat(document.getElementById ( 'n2' ) . value); var oper = document.getElementById ( 'operators' ) . value; if (oper === '+') { document.getElementById ('result') .value = n1+n2; } if (oper === '-') { document.getElementById ('result') .value = n1-n2; } if (oper === '/') { document.getElementById ('result') .value