Skip to content

Instantly share code, notes, and snippets.

View jasjs1's full-sized avatar
💭
Hmmmm, how do I do this....

Jayce Sagvold jasjs1

💭
Hmmmm, how do I do this....
View GitHub Profile
@jasjs1
jasjs1 / index.js
Created May 29, 2023 19:31
Make HTML textarea size adapt to the amount of text that is in the textarea
const textarea = document.getElementById('example-element'); // Replace example-element with the ID of your HTML textarea element.
textarea.addEventListener('input', function() {
this.style.height = 'auto';
this.style.height = this.scrollHeight + 'px';
});
@jasjs1
jasjs1 / loadImage.js
Created May 20, 2023 18:31
Image preview using HTML and JavaScript
// JS
let img = document.getElementById('img');
let input = document.getElementById('input');
input.onchange = (e) => {
if (input.files [0]) {
img.src = URL.createObjectURL(input.files[0]);
}
}
@jasjs1
jasjs1 / programming-language-selector.html
Last active May 5, 2023 00:54
HTML selector of popular programming languages
<div class="programming-languages">
<label for="tags">Tags:</label>
<select id="tags" name="tags">
<option>#uncategorized</option>
<option>#ada</option>
<option>#assembly</option>
<option>#angular</option>
<option>#bash</option>
<option>#awk</option>
<option>#c</option>