"FOCUSIN" and "FOCUSOUT" functions, doesn't work in the developing plugin
hello,
i created a plugin to erase the value in the input text or password with the focus in, and insert the default value with the focus out, if there is not value in the input.
it doesn't work into focusin and focusout functions, why ?
thank for help.
here is the code :
- (function($) {
$.fn.focusInputValue = function() {
var $$ = $(this);
var selector = $('input:text, input:password, textarea');
$$.focusin( function() {
alert('IN');
$(this).attr('value', '');
});
$$.focusout( function() {
alert('OUT');
if( $(this).attr('value') == '') {
$(this).attr( 'value', '');
}
});
return $(this);
};
}) (jQuery);
-
- // Use the plugin
- $('input:text, input:password, textarea').focusInputValue();