JavaScript Getting the value of a button when the button is clicked, javascript get value button jquery,get value button javascript,get value

By doing :

each u in requests
    form.form-horizontal(method="post")
        input(type='button', value='Accept #{u.friend}', onclick='doAction(this)')
        input(type='button', value='Ignore #{u.friend}', onclick='doAction(this)')

and in you js :

function doAction(obj){
    console.log(obj.value)
}
Answer:1

Here is a DEMO to get the value of button with JS

HTML

<input type="button" value="1" onclick="getValue(this.value)">

JS

function getValue(value){
    alert(value)
    }
Answer:2

It's a simple question. If I click the box , I want to move 200px to the left. but it's hard to me Please help me! where's the problem? <style> .box { width: 200px; height: 200px; ...

It's a simple question. If I click the box , I want to move 200px to the left. but it's hard to me Please help me! where's the problem? <style> .box { width: 200px; height: 200px; ...

  1. mouse click wont move

I have a function that is triggered when .btn is clicked, it will check if the input and text area with the class .req are filled or not. If not, its suppose to select only the empty elements and add ...

I have a function that is triggered when .btn is clicked, it will check if the input and text area with the class .req are filled or not. If not, its suppose to select only the empty elements and add ...

The code below is a simple Node.js web server that responds to a request when the URL is matched. Researching online about node.js it is stated that once you start your script (node index.js) ...

The code below is a simple Node.js web server that responds to a request when the URL is matched. Researching online about node.js it is stated that once you start your script (node index.js) ...

  1. how does node server work
  2. what server does node js use
  3. does react need node server
  4. what web server does node js use
  5. does node.js need web server
  6. how does node js server work
  7. node server does not respond
  8. node server does not start
  9. does node.js replace web server
  10. what does node server do
  11. does nodejs need a server

I'm trying to take an array of objects and, without mutating the original array, rename a specific key in each object. I've created a new variable and assigned it to the result of using 'map' on my ...

I'm trying to take an array of objects and, without mutating the original array, rename a specific key in each object. I've created a new variable and assigned it to the result of using 'map' on my ...