Getting You More Closer ...



Themes and Plugins for you, just Download them.


Tech & Programming

Quick start learning more tech tips and basic software development


Ed Systems

Both free and paid Edcartech systems with "self Demonstration".

(Javascript) Calculate numbers mixed with Symbols in a field

Posted by
/ / Leave a comment

Hi Guys, today am going to show how you can calculate the sum of numbers in an HTML text field mixed with symbols, let’s just say in this scenario you have an HTML text field which contains numbers separated by symbols for instance a dash (-) after some counted numbers for example 10-53-63-45 and you would just like to compute all the four numbers together without considering the fact that they are separated with this (-) symbols. do not fear anything because there is surely a way to deal with the situation.
the javascript code below is ideal to do that for you.

the Jsfidle bellow will show the live usage of the code presented above

in case you want to use any other way with your HTML elements you can replace $("#Your_Result_Field_Key").val(result); with document.getElementById('Your_Result_Field_Key').value = result; it also works perfectly


Leave a comment