JavaScript required
We’re sorry, but Coda doesn’t work properly without JavaScript enabled.
Skip to content
Gallery
Webflow Code SheatCheet
Typographie
Ancre & Scroll
CSS effects
Images / Vidéos / SVG
Responsive
Formulaires
Javascript
Autre
Une question ? (FAQ)
Search and Highlight
List item bullet point changement
Ordering Nested Collection list (croissant)
Alternating cms item flex gauche droite
foodles code
Scroll mobile menu
Utiliser le Tabs de Webflow en hover :
Test
More
Share
Explore
Formulaires
Accepter tel ou mail form (Armand)
<!-- Validation des champs email et tel -->
<script>
const btn = document.querySelector('._w-form-input-cta .btn-form')
const els = document.querySelectorAll('._w-form-input-cta .form-field-cta')
btn.disabled = true
btn.classList.add('disabled')
els.forEach((e, i) => {
const onChange = (ev) => {
console.log(ev)
if (i === 0) {
const emailRegex = /^[a-zA-Z0-9.!#$%&'*+/=?^_`{|}~-]+@[a-zA-Z0-9-]+(?:\.[a-zA-Z0-9-]+)*$/
const isEmail = emailRegex.test(String(ev.target.value).toLowerCase())
if (isEmail) {
btn.disabled = false
btn.classList.remove('disabled')
} else {
btn.disabled = true
btn.classList.add('disabled')
}
}
if (i === 1) {
const phoneRegex = /^((\+)33|0)[1-9](\d{2}){4}$/g
const isPhone = phoneRegex.test(String(ev.target.value).toLowerCase())
if (isPhone) {
btn.disabled = false
btn.classList.remove('disabled')
} else {
btn.disabled = true
btn.classList.add('disabled')
}
}
}
e.addEventListener('input', onChange)
})
</script>
<!-- No-scroll quand le menu mobile est ouvert -->
<script>
document.addEventListener('DOMContentLoaded', () => {
document.querySelectorAll('#navigation-hamburger').forEach(trigger => {
trigger.addEventListener('click', function(){
this.x = ((this.x || 0) + 1)%2;
if(this.x){
document.querySelectorAll('.body-new').forEach(target => target.classList.add('no-scroll'));
}
else{
document.querySelectorAll('.body-new').forEach(target => target.classList.remove('no-scroll'));
}
});
});
});
</script>
Bug empty accepted
Want to print your doc?
This is not the way.
Try clicking the ⋯ next to your doc name or using a keyboard shortcut (
Ctrl
P
) instead.