How to make fullscreen textarea without Jquery or any library?
let el = document.getElementById('#t')
const fullScrenn = () => {
//there way to do that .
}
<textarea id="el" cols="30" rows="10"></textarea>
<button onclick="fullScrenn()">Full Screen</button>
The cols attribute specifies the visible width of a text area. Tip: The size of a text area can also be set by the CSS height and width properties.
Full-screen can be activated for the whole browser window by pressing the F11 key. It can be exited by pressing the Esc button.
Inside that <div> element, we create a text area with a certain number of columns and rows. In this case, it is 30 and 15 respectively. After that, we set the width property to 100% to make a textarea width 100%. HTML Code: The HTML code contains a <textarea> element that holds rows and columns values.
We can set the size for the text area by using rows and columns. rows*columns will be the size of the text area. For columns, we have to use the cols keyword.
'use strict';
document.querySelector('#myButton').addEventListener('click', () => {
document.querySelector('#myTextarea').style.width="100vw";
document.querySelector('#myTextarea').style.height="100vh";
});
<textarea id="myTextarea" cols="20" rows="20"></textarea>
<button id="myButton">Full Size</button>
Just set the width and height of the textarea
to 100vw
(the width of the screen) and 100vh
(the height of the screen).
Alternatively you could use window.innerWidth
and window.innerHeight
instead of those values.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With