Created
September 15, 2017 21:54
-
-
Save lamosty/8c9b9d18e087ec0c3c24e1c8347f4dae to your computer and use it in GitHub Desktop.
some js
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
<script> | |
/* | |
Custom functionality for safari and IE | |
*/ | |
(function( d ) { | |
// In case the placeholder functionality is available we remove labels | |
if ( ( 'placeholder' in d.createElement( 'input' ) ) ) { | |
var label = d.querySelector( 'label[for=subscribe-field-]' ); | |
label.style.clip = 'rect(1px, 1px, 1px, 1px)'; | |
label.style.position = 'absolute'; | |
label.style.height = '1px'; | |
label.style.width = '1px'; | |
label.style.overflow = 'hidden'; | |
} | |
// Make sure the email value is filled in before allowing submit | |
var form = d.getElementById('subscribe-blog-'), | |
input = d.getElementById(''), | |
handler = function( event ) { | |
if ( '' === input.value ) { | |
input.focus(); | |
if ( event.preventDefault ){ | |
event.preventDefault(); | |
} | |
return false; | |
} | |
}; | |
if ( window.addEventListener ) { | |
form.addEventListener( 'submit', handler, false ); | |
} else { | |
form.attachEvent( 'onsubmit', handler ); | |
} | |
})( document ); | |
</script> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment