Created
September 7, 2023 07:41
-
-
Save airarm/d8bc134052af8a6dce7f03acf6995984 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const mobilePlaceholders = () => { | |
document.querySelectorAll('[data-mobile-placeholder]')?.forEach(el => { | |
if(window.innerWidth <= 1100){ | |
el.setAttribute('placeholder', el.dataset.mobilePlaceholder); | |
}else{ | |
el.removeAttribute('placeholder'); | |
} | |
}); | |
} | |
mobilePlaceholders(); | |
window.addEventListener('resize', mobilePlaceholders); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment