text
stringlengths
0
106k
```javascript
let textareas = document.querySelectorAll('textarea');
textareas.forEach(textarea => {
textarea.addEventListener('input', autoResize, false);
});
function autoResize() {
this.style.height = 'auto';
this.style.height = this.scrollHeight + 'px';
}
```
In this updated code, `document.querySelectorAll('textarea')` is used to select all textareas in the document, and then the `forEach` method is used to add the event listener to each textarea.
[USER]: <!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>Simple Website</title>
<!--Bootstrap CSS-->
<link rel="stylesheet" href="https://stackpath.bootstrapcdn.com/bootstrap/4.3.1/css/bootstrap.min.css">
<!--Custom CSS-->
<link rel="stylesheet" href="style.css">
</head>
<body>
<div class="container d-flex flex-column align-items-center vh-100">
<div class="input-container">
<label for="prompt" class="form-label">Prompt</label>
<textarea id="prompt" class="form-control mb-3" rows="1" placeholder="Type a prompt..."></textarea>
</div>
<div class="input-container">
<label for="prompt" class="form-label"> Negative Prompt</label>
<textarea id="prompt" class="form-control mb-3" rows="1" placeholder="Type a negative prompt..."></textarea>
</div>
<button class="btn btn-primary mt-auto">Submit</button>
</div>
<!--Bootstrap JS-->
<script src="https://stackpath.bootstrapcdn.com/bootstrap/4.3.1/js/bootstrap.min.js"></script>
<!--Custom JS-->
<script src="script.js"></script>
</body>
</html>
body {
background: #f8f9fa;
}
.container {
padding: 2rem;
}
.input-container {
text-align: left;
width: 100%;
}
.form-label {
font-size: 0.8rem;
font-weight: bold;
color: #333;
margin-bottom: 0.5rem;
}
.form-control {
height: auto;
font-size: 1.2rem;
overflow: hidden;
resize: none;
}
.btn {
height: 3rem;
font-size: 1.2rem;
width: 100%;
}
let textareas = document.querySelectorAll('textarea');
textareas.forEach(textarea => {
textarea.addEventListener('input', autoResize, false);
});
function autoResize() {
this.style.height = 'auto';
this.style.height = this.scrollHeight + 'px';
}
I want to add a dropdown after the negative prompt field that retains the look of the input fields(label is Provider)
[AI]: Sure, you can add a dropdown (select) element after the negative prompt field. Here's the updated HTML:
```html
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>Simple Website</title>
<!--Bootstrap CSS-->
<link rel="stylesheet" href="https://stackpath.bootstrapcdn.com/bootstrap/4.3.1/css/bootstrap.min.css">
<!--Custom CSS-->