input default value Jquery
Posted
by
venom
on Stack Overflow
See other posts from Stack Overflow
or by venom
Published on 2011-01-04T08:50:34Z
Indexed on
2011/01/04
8:54 UTC
Read the original article
Hit count: 264
$(".box_yazi2").each(function() {
var default_value = this.value;
$(this).css('color', '#555'); // this could be in the style sheet instead
$(this).focus(function() {
if(this.value == default_value) {
this.value = '';
$(this).css('color', '#000');
}
});
$(this).blur(function() {
if(this.value == '') {
$(this).css('color', '#555');
this.value = default_value;
}
});
});
});
This function of default value of input doesnt work in FF, but perfectly works in IE and ofcourse the input itself looks like this:
<input type="text" class="box_yazi2" id="konu" name="konu" value="Bos" />
© Stack Overflow or respective owner