JavaScript Calculate 2 Numbers Form Input Text - Addition, Subtraction, Multiplication, Division

Sdílet
Vložit
  • čas přidán 27. 08. 2024

Komentáře • 113

  • @RandomFacts-UTube
    @RandomFacts-UTube Před 2 lety +6

    Btw, this tutorial helps me a lot. I was confused a lot but then u came with this video to pull me out from that confusion and difficulty, thanks a lot. ❤️

  • @rheyllcansico1677
    @rheyllcansico1677 Před 2 lety +1

    Thank you so much bro, I've been struggling for my assignment and i found your video thank you

  • @MankeyMite
    @MankeyMite Před 4 lety +1

    was trying to figure out why my code wasn't working for hours,, and the problem was a capital C in the word "calc" :)) happy it works now tho!

  • @ChandanKumar-lj8go
    @ChandanKumar-lj8go Před 3 měsíci +1

    Thanks you 👍

  • @hothanmohaet672
    @hothanmohaet672 Před rokem +1

    Thank you man u solve my assignment ♥️♥️😅

  • @extraexplorer
    @extraexplorer Před 2 lety +2

    Simple code but teached a lot of concepts..
    Thanks 👍❤️

  • @bass_by296
    @bass_by296 Před 9 měsíci +2

    Perfect❗

  • @AutOdometer
    @AutOdometer Před 7 lety +1

    thank you thank you thank you!!! using something simple like this for my website to basically add horsepower inputs to create a combined horsepower page for someone to calculate horsepower if there were to MOD their car... thank you again! it worked!!!

  • @bengalitablabeats6037
    @bengalitablabeats6037 Před 3 lety +1

    Thank you so much for making this video........... it really helped me a lot....

  • @Noor-gv8ec
    @Noor-gv8ec Před 5 lety +1

    There's no need to write an if statement. You can also add them on this way. Here's the code.
    function myFunction() {
    var x = parseInt(document.getElementById("b1").value);
    var y = parseInt(document.getElementById("b2").value);
    var z = x + y;
    document.getElementById("demo").innerHTML = z;
    }

  • @raul2484
    @raul2484 Před 4 lety +3

    THANK YOU SOOOOOOO MUCH MAN! THIS TUTORIAL IS THE POWERFUL ONE!!!! 😃😃😃😃😃😃😃😃😉😉😉😉😉😉😎😎😎😎😎😎

  • @sujinlu738
    @sujinlu738 Před 3 lety +1

    thanks this finished the last part I was struggling on

  • @AidanNorde
    @AidanNorde Před 4 lety +2

    thank you, this fixed a huuuge bug i had

  • @rohithawijethunga995
    @rohithawijethunga995 Před 3 lety +1

    Thank you !

  • @rooticaa2842
    @rooticaa2842 Před 5 lety +2

    Great Tutorial!!
    You saved my a**
    Thanks!!

  • @vipchhora7351
    @vipchhora7351 Před 3 lety +1

    Thanks

  • @carolinecarol5455
    @carolinecarol5455 Před 2 lety

    Thank you so mush!! very very good 🙏🙏🙏🙏🙏🙏🙏🙏🙏🙏🙌🙌😀😀

  • @tinalee8686
    @tinalee8686 Před 3 lety +1

    Thanks a lot❤

  • @hazirahmuslim
    @hazirahmuslim Před 3 lety +1

    Thanks! It worked! ^^

  • @clement4386
    @clement4386 Před 4 lety

    Thanks a lot for your tutorial

  • @boredcat8421
    @boredcat8421 Před 2 lety

    thank you

  • @ayman1624
    @ayman1624 Před rokem

    just what I needed thanks g

  • @realtalkjames2408
    @realtalkjames2408 Před 4 lety

    Thanks a bunch lad, helpful !

  • @azma7md
    @azma7md Před 6 lety +1

    thank u ,u helped me alot

  • @vimadanutalai1008
    @vimadanutalai1008 Před rokem +1

    Thank you for concept .I’ll try this in my project ❤

  • @digitaldata-surveying
    @digitaldata-surveying Před 4 lety +1

    thanks

  • @KrishnaWyvern
    @KrishnaWyvern Před 6 lety +1

    Thanks bhai shukriya

  • @chennaiahe8509
    @chennaiahe8509 Před 5 lety

    Very good bro... but its would be better if u added the voice.

  • @lovestories701
    @lovestories701 Před 4 lety +1

    thanks sir

  • @Hqmzlch
    @Hqmzlch Před 2 lety +1

    Thanks mate! (y)

  • @abashraf6279
    @abashraf6279 Před 2 lety

    Thanks man

  • @yayantar
    @yayantar Před 2 lety

    Thanks !

  • @rahatmalik-dl9ue
    @rahatmalik-dl9ue Před 3 lety +1

    Bro my code does not form a equal to sign

    • @1BestCsharpblog
      @1BestCsharpblog  Před 3 lety

      well it should be, are you puting the '=' in the right place?

  • @rajpandey7491
    @rajpandey7491 Před 5 lety +1

    Thanks bro

  • @azizbraig1243
    @azizbraig1243 Před 6 lety +1

    Thanks
    I like it

  • @prottaybadhon8112
    @prottaybadhon8112 Před 5 lety +1

    thanks a lot

  • @roshanzamry2589
    @roshanzamry2589 Před 2 lety +1

    thanks man

  • @MuhammadAslam-vb3se
    @MuhammadAslam-vb3se Před 6 lety

    hamasaaa khush rhooo ustaaad....

  • @abiramis2298
    @abiramis2298 Před 5 lety

    Can we also make use of radio button instead of Dropbox ?will it work the same?

  • @3ia14_dhamariogymnastiarno9

    thanks it good job (y)

  • @uncuttricks4387
    @uncuttricks4387 Před 5 lety +1

    i add 2 more values in your code but it's showing "" nul "" . is it compulsory to add all values ? . how to fix it

  • @tanaysambrani176
    @tanaysambrani176 Před 4 lety +1

    Thank you so much. Great tutorial 😍

  • @prasadmadushan
    @prasadmadushan Před 5 lety +1

    thanks a lot :)

  • @LetsDoDifferent
    @LetsDoDifferent Před 6 lety +1

    Nice sir
    How add
    2*3*8*5*3*5=
    CREATE please

  • @user-ri3im8vt5y
    @user-ri3im8vt5y Před 6 měsíci

    Good. But why is there no sound???

  • @AhsanRaza-mx2ty
    @AhsanRaza-mx2ty Před 5 lety +1

    thank u

  • @RandomFacts-UTube
    @RandomFacts-UTube Před 2 lety +1

    Haven't u put any voice over in this video? Or my device gonna stop working properly...?

  • @codeAlongwith
    @codeAlongwith Před 5 lety

    Wow great! Would putting html elements around these such as divs have any impact?

  • @nitinmaurya2269
    @nitinmaurya2269 Před 4 lety

    Aap kis text editor ka use krte ho?

  • @KURT-nw7eb
    @KURT-nw7eb Před 4 lety

    Is there a way to do it without the button and only the select??

  • @HarishKumar-lw2ze
    @HarishKumar-lw2ze Před 6 lety +1

    plz add this type video : I have a four textbox. first i give one number in first box textbox and other textbox we have value , then remaining three textbox automatically decrease the value and show that textbox 0

  • @kazuma4643
    @kazuma4643 Před 2 lety

    thanks sir! but i want to know how to do (a+bi)*(c+di)?

  • @raheels.1068
    @raheels.1068 Před 6 lety

    hi i look lot of videos but i cant find any thing which show how i can use code to add.
    id, code, then amount,date, update,delete. next page,
    if i want to know with code(serial number) how much amount have. or how many time i use this serial number
    serial number of a card. as bank card. but there is lot of cards. so if i want to know how many time i use it to add money or take out money..
    can you make a example of this ? THANKS

  • @onlineworkwear941
    @onlineworkwear941 Před 5 lety

    How do you set n2 to be a fix numeric value? So for example if you wanted to calculate the price of something: n1(qty) x n2($2.50)

    • @1BestCsharpblog
      @1BestCsharpblog  Před 5 lety +2

      you can add "readonly" to your input
      like this --
      or use a span instead

  • @Atrophyiies
    @Atrophyiies Před 6 lety +1

    what do I do if I want add subtract to be buttons not a drop down? please help

    • @1BestCsharpblog
      @1BestCsharpblog  Před 6 lety

      just add the code for subtract to the button onclick event

  • @erosveizi91
    @erosveizi91 Před 7 lety +1

    Cant Understand only one thing and it looks very strange.
    If i save the result in a variable inside the function: var result=document.getElementById('result').value;
    result=num1+num2;
    the result wont show in its textbox.
    But if i write:
    var result=document.getElementById('result');
    result.value=num1+num2;
    then everything is alright.
    Can you please explain me this???

    • @1BestCsharpblog
      @1BestCsharpblog  Před 7 lety

      In " var result=document.getElementById('result').value; "
      the "result" have the value of the textbox [ Ex: 1,2,999, 2348.................. ]
      and in " var result=document.getElementById('result'); "
      the "result" have the reference of the textbox
      so you can set the value to the textbox using the "result" var (result.value=num1+num2;)

    • @CyberTronXXX
      @CyberTronXXX Před 7 lety

      Do you have the result outside the function? Because then it would be unable to pick up the variable, because if you write it inside, then it will ofcourse only count for inside the function and not out of it. Unsure of what's your problem as I cannot see the code.

  • @youssefammi1436
    @youssefammi1436 Před 2 lety

    Switch is better than this or not

  • @tanny_edits
    @tanny_edits Před 4 lety

    can you please add buttons, instead of typing numbers , use buttons i hope you can do it

  • @sergeseveau6258
    @sergeseveau6258 Před rokem

    could you please show me how to limit the answer to 2 decimal places - thank you in advance. 👍

    • @1BestCsharpblog
      @1BestCsharpblog  Před rokem +1

      document.getElementById('result').value = calculationResult.toFixed(2);

    • @sergeseveau6258
      @sergeseveau6258 Před rokem

      @@1BestCsharpblog WOW thank you so much - - but where do I put this statement (sorry for being so dumb)

  • @metkic94
    @metkic94 Před 4 lety

    Wont add decimal numbers that are bellow 1 , 0.5+0.5...

  • @nannthithihein4591
    @nannthithihein4591 Před 11 měsíci

    how to change result infinity to zero when 2/0

  • @Depressso
    @Depressso Před 2 lety

    Is there a way to make this in c#/wpf

  • @msann2060
    @msann2060 Před 5 lety

    Atlast i found thia now i can make my own calculator

  • @jjkklls
    @jjkklls Před 2 lety

    mine was works but the results just show for a sec. it doesnt show permanently, help me pls. Sorry for my bad english

  • @madhavanmadhavan7786
    @madhavanmadhavan7786 Před 5 lety

    whats happen when i give else part after the if part?

  • @kevinsigue1207
    @kevinsigue1207 Před 6 lety

    does this works if multiple dots(.) will be inputted? and how to make the dot appear only once?

    • @1BestCsharpblog
      @1BestCsharpblog  Před 6 lety

      you need to check the text field already contains a dot
      watch this calculator tutorial to learn more
      czcams.com/video/3Qt-wiMjV78/video.html

    • @kevinsigue1207
      @kevinsigue1207 Před 6 lety +1

      thanks :D

  • @sethlegaspi4336
    @sethlegaspi4336 Před 5 lety

    Whats is the problem i input 5 and 3 and to multiply it became 15555???? What happened????

  • @jyotsnawankhede8440
    @jyotsnawankhede8440 Před 5 lety

    i wrote all the functions properly but it is not coming in internet explorer properly

  • @dhananabimanto429
    @dhananabimanto429 Před 4 lety

    how to write square operation code?

  • @jyotsnawankhede8440
    @jyotsnawankhede8440 Před 5 lety

    please tell why it is not comming or tell othet methof

  • @YoungFuji-ct8hf
    @YoungFuji-ct8hf Před 5 lety

    Would a switch statement work with all this?

    • @spiderweb3324
      @spiderweb3324 Před rokem

      off course it will work. He was made this with if else and on click function, you can do it with addEventListener grab value of operators and then with switch manipulate with numbers.

  • @justinpettit3432
    @justinpettit3432 Před 6 lety

    Is it JavaScript they use for the fantasy football websites to add your points up and everything? If so do u know a vid that shows how u do that? If not do u know what they use to do that.

  • @ManishaGupta-yu1sr
    @ManishaGupta-yu1sr Před 6 lety +1

    Nyc

  • @subhihokan556
    @subhihokan556 Před 6 lety

    Hi I have a question. How i can do if I want the answer become blue and if negative answer become red ?

    • @hanan-aslam
      @hanan-aslam Před 6 lety

      :-D

    • @spiderweb3324
      @spiderweb3324 Před rokem

      creating another class and add it to element, and when condition becomes true adding that class with style to that element.

  • @b5etcraft
    @b5etcraft Před 4 lety

    how can i take any number of inputs ? how can i create array in HTTML ?

  • @shiaclark3067
    @shiaclark3067 Před 5 lety

    does not work for me at all

  • @ezequiel_____
    @ezequiel_____ Před 7 lety

    What software you use ?

  • @jbruce87
    @jbruce87 Před 2 lety +1

    Lol, all these unanswered questions

  • @EldenSoulsVids
    @EldenSoulsVids Před 4 lety

    mine wasnt working right because i put the script section in the body instead of the head in case anyone else did that lol

  • @VikramVikram-zr7xk
    @VikramVikram-zr7xk Před 6 lety

    Sir output is not shown. What can I do

    • @1BestCsharpblog
      @1BestCsharpblog  Před 6 lety

      1 - find the problem
      2 - fix the problem
      3 - source code link in the description

    • @anjuvishwas309
      @anjuvishwas309 Před 3 lety

      @@1BestCsharpblog I tried and everything is correct but still I can't see the result

  • @user-zw2vv8xb7v
    @user-zw2vv8xb7v Před 4 lety

    0:43

  • @rayhanulislam4104
    @rayhanulislam4104 Před 5 lety

    It doesn't work

  • @uncuttricks4387
    @uncuttricks4387 Před 5 lety

    bhai iska kasa banega ?
    Example
    a+b+c+d = e
    e+ f= g

  • @TheRealRaynex
    @TheRealRaynex Před 3 lety

    thank you

  • @tibormolnar2213
    @tibormolnar2213 Před 4 lety +1

    Thank you!