-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathscript.js
23 lines (20 loc) · 948 Bytes
/
script.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
document.getElementById('myInput').addEventListener('input', function() {
this.style.fontSize = '5vh';
this.style.width = 'auto';
this.style.height = 'auto';
this.style.width = (this.scrollWidth + 10) + 'px'; // Add 10px for padding
this.style.height = (this.scrollHeight + 10) + 'px'; // Add 10px for padding
});
document.getElementById('alignLeftBtn').addEventListener('click', function(event) {
event.preventDefault(); // Prevent form submission
document.getElementById('myInput').style.textAlign = 'left';
});
document.getElementById('alignCenterBtn').addEventListener('click', function(event) {
event.preventDefault(); // Prevent form submission
document.getElementById('myInput').style.textAlign = 'center';
});
document.getElementById('alignRightBtn').addEventListener('click', function(event) {
event.preventDefault(); // Prevent form submission
document.getElementById('myInput').style.textAlign = 'right';
});
``