Skip to content

Instantly share code, notes, and snippets.

View Steamforge's full-sized avatar
💻
I fight for the User

Josh Studley Steamforge

💻
I fight for the User
View GitHub Profile
@Steamforge
Steamforge / floating-label.markdown
Created September 20, 2018 20:17
Floating label
@Steamforge
Steamforge / floating-label.js
Last active April 30, 2019 19:13
A function to apply floating labels to input fields
const FloatLabel = (() => {
// add active class
const handleFocus = (e) => {
const target = e.target;
target.parentNode.classList.add('active');
target.setAttribute('placeholder', target.getAttribute('data-placeholder'));
};
// remove active class
@Steamforge
Steamforge / template-literal-function.js
Last active July 2, 2021 12:43
A Template Literal Funciton
// an array of colors
let colors = ['red', 'green', 'blue'];
// a function to build a list
let makeTemplate = function (data) {
let newList = '';
data.forEach(function(element) {
newList += `<li>${element}</li>`;
});
return newList;
@Steamforge
Steamforge / form-validation.html
Last active January 14, 2020 06:44
Form Validation
<form id="signUpForm">
<input type="email" id="emailField" required>
<button id="okButton" disabled>OK</button>
</form>
<script>
const signUpForm = document.getElementById('signUpForm');
const emailField = document.getElementById('emailField');
const okButton = document.getElementById('okButton');