passing html vlaues to Javascript function

<body>
<h1>Adding 'a' and 'b'</h1>

  a: <input type="number" name="a" id="a"><br>
  b: <input type="number" name="b" id="b"><br>
  <button onclick="add(document.getElementById('a').value,document.getElementById('b').value)">Add</button>

<script>
  function add(a,b) {
    var sum = parseInt(a) + parseInt(b);
    alert(sum);
  }
</script>
</body>

Are there any code examples left?
Create a Free Account
Unlock the power of data and AI by diving into Python, ChatGPT, SQL, Power BI, and beyond.
Sign up
Develop soft skills on BrainApps
Complete the IQ Test
Relative searches
pass html variable to javascript function passing a javascript function to html tag pass html value to javascript function how to pass html to javascript function html pass input value to javascript html call javascript function with parameters from inputs pass value html to javascript passing html vlaues to Javascript function how to pass parameter in html function how to pass in an html element to javascript function as parameter how to pass value from javascript to html input html form functions parameters js function submit parameter pass element from input text javascript use input to function parameter passing html input value to javascript how to pass input field value in javascript function get value of input passed to function how to pass html input value in javascript pass value in html javascript pass list as data argument in input html access arguments input value js send parameter to javascript function from html Passing HTML input value as a JavaScript Function Parameter pass paramenter to a function called in html input tag how to pass value from javascript function to html how to pass value on a function with @input? pas data from get function to html javascript how to pass some value into the html from javascript passing data from input into method javascript how to pass parameters in javascript from html how to pass value from html to javascript how to pass data form Together Value input to function javascript how to pass data form value from to function javascript passing data from html to javascript without clicking pass js argument from html js pass input value to function pass user input to javascript function pass value to javascript function from html at the typing how to feed a js argument from html pass js value to html js function js on input as an argument pass valu pass parameter from input HTML to javascript method html send arguments to javascript how to pass input from html to javascript html form pass input value to function send input value to javascript function javascript pass text value from input javascript input pass value pass input text value to javascript function how to pass input value to function in javascript javascript passing html parameters how to pass value of input box to function in javascript html send parameters to javascript pass input value to javascript parameter how to take input and pass it to javascript how to pass attribute value in javascript function pass input from html to javascript how to pass in user input in javascript function how to pass input value in javascript function pass input value to function how to pass function variable values to different in put text fields pass input value in input function pass &lt;input&gt; tag value in function pass &lt;input&gt; value in function how to pass parameters in javascript form html how to pass document values in javascript function pass valut to a function in html form pass valut to a function in html pass input value to js function input value pass in javascript pass atribute from html element to javascripts pass value of input to javascript function How pass parameter from JavaScript to HTML? send input value to javascript function by name javascript get argument and place result in input box pass html inputvalue to other input function sending a parameter from html to javascript how to pass value to html from javascript javascript pass value from html javascript pass input value to function pass value in html to javascript how to pass webpage inputs and labels to a javascript function js send inputs to function html pass data to javascript function how to pass value from form to javascript function passing variable from html to js function how to pass value to a function in html js pass data from html to javascript pas parameter value from html tag to function js pass html input to javascript function sending input from html to javascript how to pass a variable in javascript function to html html form how to pass to javascript when button is clicked java script pass input value pass value as parameter in javascript to html send number to input with javascript html javascript pass parameter javascript transfer html input value pass argument to javascript function in html how to pass the element value from html tag to js how to send E parameter in javascript html how to give a function for input in html pass new imput value into a function html pass value to javascript function through tag how to pass parameter in javascript function from html js html input as parameters html pass value to javascript function using this pass number of data from javascript to html pass input value to javascript function how to pass parameters to javascript function from html on load how to pass the value from html to javascript pass number from html to javascript pass an element value while calling a javascript function html pass value to javascript function passing input value through to javascript function how to pass html input as parameters how to pass a form input value into a javascript function pass value to javascript function from html how to get the value passed from input to javascript
Made with love
This website uses cookies to make IQCode work for you. By using this site, you agree to our cookie policy

Welcome Back!

Sign up to unlock all of IQCode features:
  • Test your skills and track progress
  • Engage in comprehensive interactive courses
  • Commit to daily skill-enhancing challenges
  • Solve practical, real-world issues
  • Share your insights and learnings
Create an account
Sign in
Recover lost password
Or log in with

Create a Free Account

Sign up to unlock all of IQCode features:
  • Test your skills and track progress
  • Engage in comprehensive interactive courses
  • Commit to daily skill-enhancing challenges
  • Solve practical, real-world issues
  • Share your insights and learnings
Create an account
Sign up
Or sign up with
By signing up, you agree to the Terms and Conditions and Privacy Policy. You also agree to receive product-related marketing emails from IQCode, which you can unsubscribe from at any time.
Creating a new code example
Code snippet title
Source