get value of input element on button click react
const input = props => {
let textInput = React.createRef();
function handleClick() {
console.log(textInput.current.value);
}
return (
<div>
<input ref={textInput} placeholder="Type a message..." />
<div onClick={handleClick} className="icon">
<i className="fa fa-play" />
</div>
</div>
)
}
Also in JavaScript:
- create react component class
- async await arrow function
- ApexCharts
- javascript celcius to farenheit
- count characters in typescript
- remove last element from array javascript
- how to install all needed modules in node
- javascript conver time into 24 hour format
- js string to object
- transpose an array in javascript
- how to loop over dom objects javascript
- js array add element
- read json data from file
- jquery form id submit
- how to set the width and heigth of the canvas to be the same size as that of an image
- js append to array
- get current month of year in number javascript
- upload form with doc type in ajax
- angular input force uppercase
- indexof()
- get unchecked checkbox jquery
- for loop in jquery array
- how to make a div sticky using js
- round down js