how to know which button clicked in javascript
JavaScript
<!DOCTYPE HTML>
<html>
<head>
<title>
Get the ID of the clicked button
using JavaScript
</title>
</head>
<body style = "text-align:center;">
<h1 style = "color:green;" >
GeeksForGeeks
</h1>
<p id = "GFG_UP" style =
"font-size: 15px; font-weight: bold;">
</p>
<button id="1" onClick="GFG_click(this.id)">
Button1
</button>
<button id="2" onClick="GFG_click(this.id)">
Button2
</button>
<button id="3" onClick="GFG_click(this.id)">
Button3
</button>
<p id = "GFG_DOWN" style =
"color:green; font-size: 20px; font-weight: bold;">
</p>
<script>
var el_up = document.getElementById("GFG_UP");
var el_down = document.getElementById("GFG_DOWN");
el_up.innerHTML = "Click on button to get ID";
function GFG_click(clicked) {
el_down.innerHTML = "ID = "+clicked;
}
</script>
</body>
</html>
Also in JavaScript:
- Title
- create tic tac toe game in react using jsx files
- Category
- JavaScript
- Title
- convert number to k m b javascript
- Category
- JavaScript
- Title
- how to run different node app on server different domains
- Category
- JavaScript
- Title
- Error: Can't resolve 'fs' webpack
- Category
- JavaScript
- Title
- how to limit characters in number input js
- Category
- JavaScript
- Title
- How do I check whether a checkbox is checked in jQuery?
- Category
- JavaScript
- Title
- extend react.component
- Category
- JavaScript
- Title
- how to get the div value in jquery
- Category
- JavaScript
- Title
- angular @Output()
- Category
- JavaScript
- Title
- Javascript change element class
- Category
- JavaScript
- Title
- html parser javascript
- Category
- JavaScript
- Title
- get date one week from now javascript
- Category
- JavaScript
- Title
- iso to date javascript
- Category
- JavaScript
- Title
- add a slash to string in javascript
- Category
- JavaScript
- Title
- call javascript function from html
- Category
- JavaScript
- Title
- ISS proxy express
- Category
- JavaScript
- Title
- copy to clipboard javascript
- Category
- JavaScript
- Title
- check if string is datestring javascript
- Category
- JavaScript
- Title
- ajax laravel example
- Category
- JavaScript
- Title
- convert string with dot or comma as decimal separator to number in javascript
- Category
- JavaScript
- Title
- find intersection between two object arrays javascript
- Category
- JavaScript
- Title
- iterate through array js
- Category
- JavaScript
- Title
- javascript Clone an array
- Category
- JavaScript
- Title
- if condition in class angular 8
- Category
- JavaScript
- Title
- how to get the size of the window in javascript
- Category
- JavaScript
- Title
- discord.js multiple embeds
- Category
- JavaScript
- Title
- at leastone checkbox required jquery
- Category
- JavaScript
- Title
- get value from textbox in vanilla javascript
- Category
- JavaScript
- Title
- how to call action from another module vuex
- Category
- JavaScript
- Title
- es6 class example
- Category
- JavaScript
- Title
- get a div text content and store in a variable js
- Category
- JavaScript
- Title
- javascript array exists check
- Category
- JavaScript
- Title
- disable right click javascript
- Category
- JavaScript
- Title
- cordova capacitor document viewer fail
- Category
- JavaScript
- Title
- fonction fleche javascript
- Category
- JavaScript
- Title
- define two variables in one line javascript
- Category
- JavaScript
- Title
- copy array javascript
- Category
- JavaScript
- Title
- bot discord comment récupérer la pdp de quelqu'un
- Category
- JavaScript
- Title
- Angular watching for changes in $http.pendingRequests from directive
- Category
- JavaScript
- Title
- how to sort array least to greatest javascript
- Category
- JavaScript
- Title
- javascript are arrays equal
- Category
- JavaScript
- Title
- how to validate an email address in javascript
- Category
- JavaScript
- Title
- append before jquery
- Category
- JavaScript
- Title
- Getting the differences between two objects javascript lib
- Category
- JavaScript
- Title
- defineCall is not a function at Sequelize.import sequelize.js
- Category
- JavaScript
- Title
- is object js
- Category
- JavaScript
- Title
- iterate object javascript
- Category
- JavaScript
- Title
- angular cli skip-tests
- Category
- JavaScript
- Title
- how to import a json string from a file in typescript
- Category
- JavaScript
- Title
- async await javascript
- Category
- JavaScript
- Title
- how to convert audio blocb to base64 string
- Category
- JavaScript
- Title
- how to deap clone an object in javascript
- Category
- JavaScript
- Title
- how to append select option in jquery
- Category
- JavaScript
- Title
- how to remove an class in javascript
- Category
- JavaScript
- Title
- is var is not blank then display value in javascript
- Category
- JavaScript
- Title
- how to test fetch
- Category
- JavaScript
- Title
- code to launch browser using javascript
- Category
- JavaScript
- Title
- electron jquery
- Category
- JavaScript
- Title
- javascript array pop
- Category
- JavaScript
- Title
- how to validate date in react
- Category
- JavaScript
- Title
- javascript ascii to hex
- Category
- JavaScript
- Title
- how to create a popup in javascript
- Category
- JavaScript
- Title
- How to uninstall npm modules in node js?
- Category
- JavaScript
- Title
- get selected option value
- Category
- JavaScript
- Title
- express how to access ajax post data
- Category
- JavaScript
- Title
- flask get summernote text
- Category
- JavaScript
- Title
- curl post file json
- Category
- JavaScript
- Title
- How do you call a functional component in React
- Category
- JavaScript
- Title
- how accurate is pi javascript
- Category
- JavaScript
- Title
- comment obtenir l'élément parent javascript
- Category
- JavaScript
- Title
- debug node
- Category
- JavaScript
- Title
- how to animate array oy react elements
- Category
- JavaScript
- Title
- how to get last string in javascript
- Category
- JavaScript
- Title
- how to add up all the numbers in between 0 and that number
- Category
- JavaScript
- Title
- angular list contains property
- Category
- JavaScript
- Title
- apache log format json
- Category
- JavaScript
- Title
- how to add element in json object
- Category
- JavaScript
- Title
- callback without duplicates javascript
- Category
- JavaScript
- Title
- How to check whether a checkbox is checked in jQuery?
- Category
- JavaScript
- Title
- javascript access pushed element
- Category
- JavaScript
- Title
- arrays javascript
- Category
- JavaScript
- Title
- how to host react app on heroku
- Category
- JavaScript
- Title
- angular sumar labels
- Category
- JavaScript
- Title
- find class using jquery
- Category
- JavaScript
- Title
- how to shallow clone javascript class
- Category
- JavaScript
- Title
- fetch api react
- Category
- JavaScript
- Title
- delete session javascript
- Category
- JavaScript
- Title
- javascript clear all intervals
- Category
- JavaScript
- Title
- 'ts-node' não é reconhecido como um comando interno ou externo, um programa operável ou um arquivo em lotes.
- Category
- JavaScript
- Title
- import jquery
- Category
- JavaScript
- Title
- how to use session using javascript
- Category
- JavaScript
- Title
- daterangepicker set maxdate
- Category
- JavaScript
- Title
- create react app in existing folder
- Category
- JavaScript
- Title
- how to get the index of an array in javascript
- Category
- JavaScript
- Title
- how to wait for an exec command to fininsh in nodejs
- Category
- JavaScript
- Title
- boucle for in js
- Category
- JavaScript
- Title
- finding an element ina na array in js
- Category
- JavaScript
- Title
- angular run with proxy
- Category
- JavaScript
- Title
- express middleware pass parameter
- Category
- JavaScript
- Title
- how to compare strings javascript
- Category
- JavaScript