Calculator removing values | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

Calculator removing values

I want the Calculator to remove "Value 2"when "sqrt" is selected and place it back when "add" "sub" "mul" or "div" are selected. https://code.sololearn.com/WTFyM95eGJw6/?ref=app https://code.sololearn.com/WTFyM95eGJw6/?ref=app

23rd Jul 2020, 7:02 AM
Stefan
Stefan - avatar
1 Answer
+ 1
if you want show or hide the second input field, on the change of the dropdown. then the calc() function will not work, because calc() function is called when you click on calculate button. so u can create a new event handler onchange upon the select dropdown , which will trigger a function, whenever you change the value of seelct field.. and since you are using jquery u can use hide() and show() method.. see the code below https://code.sololearn.com/WxJBP8B2sOwH/?ref=app
23rd Jul 2020, 7:24 AM
Мг. Кнап🌠
Мг. Кнап🌠 - avatar