FUNCTION – checkEmptyInput()

2014-09-21 • Snippets • Views: 1560

FUNCTION – checkEmptyInput()

[php]

function checkEmptyInput (idemail ,defaultvalue) {
jQuery("#"+idemail).focus(function(){
if (defaultvalue == jQuery("#"+idemail).val()) {
jQuery(this).val(”);
} // END IF
});
// FOCUSOUT INPUT
jQuery("#"+idemail).blur(function(){
if (jQuery("#"+idemail).val() == ”) {
jQuery("#"+idemail).val(defaultvalue);
} // END IF
});
} // END FUNCTION

$(document).ready(function(){
var defaultvalue = "Votre e-mail"; var idemail = ‘customerEmail';
checkEmptyInput (idemail ,defaultvalue);
jQuery("#"+idemail).focus().blur();
});

[/php]

Leave a Reply

Your email address will not be published. Required fields are marked *

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong>

Shares