Reply To: Form Placeholder not displaying on IE

Support Forums Cian – HTML Template Form Placeholder not displaying on IE Reply To: Form Placeholder not displaying on IE

#4381
Liana
Participant

I added this code and it worked, however it gets rid of the validation check on IE. i.e users can just press enter and it will submit. How can I make the validation check work with IE?

<!– Placeholder IE fix –>
<script type=”text/javascript”>
/* <![CDATA[ */
$(function() {
var input = document.createElement(“input”);
if((‘placeholder’ in input)==false) {
$(‘[placeholder]’).focus(function() {
var i = $(this);
if(i.val() == i.attr(‘placeholder’)) {
i.val(”).removeClass(‘placeholder’);
if(i.hasClass(‘password’)) {
i.removeClass(‘password’);
this.type=’password’;
}
}
}).blur(function() {
var i = $(this);
if(i.val() == ” || i.val() == i.attr(‘placeholder’)) {
if(this.type==’password’) {
i.addClass(‘password’);
this.type=’text’;
}
i.addClass(‘placeholder’).val(i.attr(‘placeholder’));
}
}).blur().parents(‘form’).submit(function() {
$(this).find(‘[placeholder]’).each(function() {
var i = $(this);
if(i.val() == i.attr(‘placeholder’))
i.val(”);
})
});
}
});
/* ]]> */
</script>