Hello, I have been looking for a way to create an overlay with a form that appears when a specific input field is clicked. I am trying to achieve this using React. Can someone please advise me on how to accomplish this?
Here is my code
import React, { Component } from 'react';
class Middle extends Component {
constructor(props) {
super(props);
this.state = {
posts: []
}
}
render() {
function displayOverlay(e) {
e.preventDefault();
alert("Now the overlay should appear");
}
return (
<div className="middle_div">
<input className='post_data_input' placeholder="Ask your question here" ref="postTxt"
onClick={displayOverlay}/>
</div>
);
}
}
export default Middle;
I have created a function that triggers an alert when the input field is clicked. Instead of the alert, I would like to show a transparent overlay with a form.
I am aiming for something similar to this example:
http://www.w3schools.com/howto/tryit.asp?filename=tryhow_js_overlay
Thank you in advance.